Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MA-17028: test strategy label on ignored issue workflow #568

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 8 additions & 28 deletions .github/workflows/set_label_for_ignored_issues.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: Set Pay attention label for ignored issues
on:
schedule:
- cron: '0 11 */2 * *'
- cron: '0 11 */7 * *'
workflow_dispatch:

jobs:
set-label-for-issues:
runs-on: ubuntu-latest
steps:
- name: Set label for issues
if: github.event.schedule == '0 11 */2 * *'
- name: Set Pay attention label for ignored issues
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -19,29 +17,11 @@ jobs:
})
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 == '0 11 */7 * *'
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) {
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,
Expand Down
Loading