diff --git a/.github/workflows/stale-draft-prs.yml b/.github/workflows/stale-draft-prs.yml deleted file mode 100644 index 3228ed7ab3a..00000000000 --- a/.github/workflows/stale-draft-prs.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Mark Stale Draft PRs - -on: - schedule: - # Run daily at midnight UTC - - cron: '0 0 * * *' - # Allow manual trigger - workflow_dispatch: - -jobs: - stale-draft: - runs-on: ubuntu-latest - permissions: - pull-requests: write - - steps: - - name: Check Draft PRs - uses: actions/github-script@v7 - with: - script: | - const now = new Date(); - const thirtyFiveMonthsAgo = new Date(now.setMonth(now.getMonth() - 35)); - - const query = `query($cursor: String) { - repository(owner: "${context.repo.owner}", name: "${context.repo.repo}") { - pullRequests(first: 100, after: $cursor, states: OPEN, isDraft: false) { - nodes { - number - createdAt - labels(first: 100) { - nodes { - name - } - } - } - pageInfo { - hasNextPage - endCursor - } - } - } - }`; - - async function getAllDraftPRs() { - let cursor = null; - let allPRs = []; - - while (true) { - const response = await github.graphql(query, { cursor }); - const prs = response.repository.pullRequests.nodes; - allPRs = allPRs.concat(prs); - - if (!response.repository.pullRequests.pageInfo.hasNextPage) { - break; - } - cursor = response.repository.pullRequests.pageInfo.endCursor; - } - - return allPRs; - } - - const prs = await getAllDraftPRs(); - - for (const pr of prs) { - const createdAt = new Date(pr.createdAt); - const hasStaleLabel = pr.labels.nodes.some(label => label.name === 'kind/stale'); - - if (createdAt < thirtyFiveMonthsAgo && !hasStaleLabel) { - console.log(`Adding stale label to PR #${pr.number}`); - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr.number, - labels: ['kind/stale'] - }); - } - } \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 6b601f52a56..541bc1f7bf0 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -28,5 +28,7 @@ jobs: days-before-issue-close: 3 days-before-pr-stale: 5 days-before-pr-close: 3 + draft-days-before-stale: 1050 # 35 months * 30 days + draft-days-before-close: -1 # Don't automatically close draft PRs remove-stale-when-updated: true enable-statistics: true