File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ name : " Auto-Update Nomination Status Labels"
2+ on :
3+ issue_comment :
4+ types : [created]
5+
6+ jobs :
7+ update-labels :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - name : Check Comment and Update Labels
11+ uses : actions/github-script@v6
12+ with :
13+ github-token : ${{ secrets.GITHUB_TOKEN }}
14+ script : |
15+ const issue = context.payload.issue;
16+ const comment = context.payload.comment.body.toLowerCase();
17+ const repoOwner = context.repo.owner;
18+ const repoName = context.repo.repo;
19+ const issueNumber = issue.number;
20+
21+ let newLabel = null;
22+
23+ if (comment.includes("approved")) {
24+ newLabel = "approved";
25+ } else if (comment.includes("rejected")) {
26+ newLabel = "rejected";
27+ } else if (comment.includes("needs more info")) {
28+ newLabel = "needs-more-info";
29+ }
30+
31+ if (newLabel) {
32+ await github.rest.issues.update({
33+ owner: repoOwner,
34+ repo: repoName,
35+ issue_number: issueNumber,
36+ labels: [newLabel]
37+ });
38+
39+ console.log(`Updated issue #${issueNumber} with label: ${newLabel}`);
40+ }
You can’t perform that action at this time.
0 commit comments