diff --git a/.github/workflows/cron-remove-label.yml b/.github/workflows/cron-remove-label.yml index 4125f9c3..9fad7012 100644 --- a/.github/workflows/cron-remove-label.yml +++ b/.github/workflows/cron-remove-label.yml @@ -12,6 +12,22 @@ jobs: - uses: actions/github-script@v6 with: script: | + # MEMO: please comment out the follwoing if you execute this script in local + #import { Octokit } from "@octokit/rest"; + #import fetch from "node-fetch"; + #const github = new Octokit({ + # auth: "${YOUR_TOKEN}", + # request: { + # fetch: fetch, + # }, + #}) + #const context = { + # "repo": { + # "owner": "cloudnativedaysjp", + # "repo": "dreamkast-ui", + # } + #} + const targetLabel = 'reviewapps'; const now = new Date(); const borderDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 3); @@ -22,7 +38,7 @@ jobs: }); prs.data.filter(d => { const updatedAt = new Date(Date.parse(d.updated_at)); - return updatedAt < borderDate && d.labels.includes(targetLabel); + return updatedAt < borderDate && d.labels.some(label => label.name == targetLabel) }).map(pr => { github.rest.issues.removeLabel({ name: targetLabel,