Nodered is crashing daily #265
This file contains 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: Remove 'waiting-for-response' label on issue comment by author | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
remove-label: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Remove label from issue if comment is from author | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const commentAuthor = context.payload.comment.user.login; | |
const labelToRemove = 'waiting for response'; | |
const issueData = { | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number | |
}; | |
// Get issue details | |
const { data: issueDetails } = await github.rest.issues.get(issueData); | |
// Check if the comment author is the issue author | |
if (issueDetails.user.login === commentAuthor) { | |
// Get the issue's labels | |
const { data: labels } = await github.rest.issues.listLabelsOnIssue(issueData); | |
// Check if the label exists and remove it | |
if (labels.some(label => label.name === labelToRemove)) { | |
await github.rest.issues.removeLabel({ | |
name: labelToRemove, | |
...issueData | |
}); | |
console.log(`Removed label '${labelToRemove}' from issue #${context.issue.number}`); | |
} else { | |
console.log(`Label '${labelToRemove}' not found on issue #${context.issue.number}`); | |
} | |
} else { | |
console.log(`Comment by non-author ${commentAuthor}. No label removed.`); | |
} |