Skip to content

Dependency Dashboard #7991

Dependency Dashboard

Dependency Dashboard #7991

name: Contribution triage - proposal accepted and community contribution
on:
issues:
types: [labeled, opened]
permissions:
issues: write
jobs:
add-comment:
name: Add comment to issues with proposal accepted and community contribution
runs-on: ubuntu-latest
steps:
- name: Log github event
env:
$GITHUB_CONTEXT_LABELS: ${{ toJson(github.event.label) }}
run: echo "$GITHUB_CONTEXT_LABELS"
- name: Conditional Check and Add Comment
id: conditional-comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
response = await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const labelArray = response.data.map((label) => label.name)
const commentsArray = comments.data.map(comment => comment.body)
const commentText = "The Carbon team has accepted this proposal! Our team doesn't have the capacity to work on this now, so we are requesting community contributors. Please see the labels for roles that are needed. If you are willing to help out, comment below and we will get in touch!"
if (labelArray.includes('proposal: accepted') && labelArray.includes('needs: community contribution') && !commentsArray.includes(commentText)) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentText
});
} else {
console.log('No comment added because the conditions are not met.');
}
- name: Set Output
if: steps.conditional-comment.outcome == 'success'
run: echo "Comment added successfully."