Plots are opened when building docs #216
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Status Labels When Author Replies | |
| on: | |
| issue_comment: | |
| types: [created] | |
| pull_request_review_comment: | |
| types: [created] | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| update_status_labels: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Update labels if author replies | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const waitingForAuthor = "Status: Waiting for Author"; | |
| const waitingForReview = "Status: Waiting for Review"; | |
| const comment = context.payload.comment; | |
| let authorLogin; | |
| let issueNumber; | |
| // Ignore bot comments | |
| if (comment.user.type === "Bot") { | |
| console.log("Ignoring bot comment."); | |
| return; | |
| } | |
| // Figure out what event type we are dealing with | |
| if (context.payload.issue) { | |
| // issue_comment event (could be issue or PR main thread) | |
| authorLogin = context.payload.issue.user.login; | |
| issueNumber = context.payload.issue.number; | |
| } else if (context.payload.pull_request) { | |
| // pull_request_review_comment event (inline code review comment) | |
| authorLogin = context.payload.pull_request.user.login; | |
| issueNumber = context.payload.pull_request.number; | |
| } else { | |
| console.log("Not an issue or PR event — skipping."); | |
| return; | |
| } | |
| // Only act if the comment is from the original author | |
| if (authorLogin !== comment.user.login) { | |
| console.log("Comment is not from the author — doing nothing."); | |
| return; | |
| } | |
| // Fetch current labels (since pull_request_review_comment doesn't include them) | |
| const { data: labels } = await github.rest.issues.listLabelsOnIssue({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issueNumber | |
| }); | |
| const currentLabels = labels.map(l => l.name); | |
| const hasWaitingForAuthor = currentLabels.includes(waitingForAuthor); | |
| const hasWaitingForReview = currentLabels.includes(waitingForReview); | |
| if (!hasWaitingForAuthor) { | |
| console.log(`No "${waitingForAuthor}" label — nothing to remove.`); | |
| return; | |
| } | |
| // Remove "Status: Waiting for Author" | |
| await github.rest.issues.removeLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issueNumber, | |
| name: waitingForAuthor | |
| }); | |
| console.log(`Removed "${waitingForAuthor}" label from #${issueNumber}`); | |
| // Add "Status: Waiting for Review" if not already present | |
| if (!hasWaitingForReview) { | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issueNumber, | |
| labels: [waitingForReview] | |
| }); | |
| console.log(`Added "${waitingForReview}" label to #${issueNumber}`); | |
| } else { | |
| console.log(`"${waitingForReview}" already present — not adding again.`); | |
| } |