-
Notifications
You must be signed in to change notification settings - Fork 5
34 lines (32 loc) · 1.2 KB
/
set_label_for_ignored_issues.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Set Pay attention label for ignored issues
on:
schedule:
- cron: '0 10 * * 1-5'
jobs:
set-label-for-issues:
runs-on: ubuntu-latest
steps:
- name: Set Pay attention label for ignored issues
uses: actions/github-script@v7
with:
github-token: ${{ secrets.DEVTOOLS_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) {
const createdDaysDelta = (new Date() - new Date(issue.created_at)) / (1000 * 60 * 60 * 24);
if (!issue.labels.length && (
(!issue.pull_request && createdDaysDelta > 2) || (issue.pull_request && createdDaysDelta > 7)
)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['pay attention']
});
}
}
}