Set Pay attention label for ignored issues #1
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: Set Pay attention label for ignored issues | |
on: | |
schedule: | |
- cron: '*/6 * * * *' | |
- cron: '*/9 * * * *' | |
jobs: | |
set-label-for-issues: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set label for issues | |
if: github.event.schedule == '*/6 * * * *' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const issuesList = await github.rest.issues.listForRepo({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}) | |
if (issuesList.data && issuesList.status === 200) { | |
for (const issue of issuesList.data) { | |
if (!issue.pull_request && !issue.labels.length) { | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issue.number, | |
labels: ['pay attention'] | |
}); | |
} | |
} | |
} | |
- name: Set label for pull requests | |
if: github.event.schedule == '*/9 * * * *' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const issuesList = await github.rest.issues.listForRepo({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}) | |
if (issuesList.data && issuesList.status === 200) { | |
for (const issue of issuesList.data) { | |
if (issue.pull_request && !issue.labels.length) { | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issue.number, | |
labels: ['pay attention'] | |
}); | |
} | |
} | |
} |