Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Close PRs with unsigned CLA after one week

Manav Rathif96ad52609e0
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 808357b779..a64ccb29e3 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -6,14 +6,46 @@ on:
workflow_dispatch:
permissions:
- contents: read
issues: write
pull-requests: write
+ statuses: read
jobs:
stale:
runs-on: ubuntu-latest
steps:
+ - name: Close pull requests missing CLA
+ uses: actions/github-script@v8
+ with:
+ script: |
+ const repo = context.repo;
+ const cutoff = Date.now() - 7 * 24 * 60 * 60 * 1000;
+
+ for (const pr of await github.paginate(github.rest.pulls.list, {
+ ...repo,
+ state: "open",
+ per_page: 100,
+ })) {
+ if (Date.parse(pr.created_at) > cutoff) continue;
+
+ const { data: { statuses } } = await github.rest.repos.getCombinedStatusForRef({
+ ...repo,
+ ref: pr.head.sha,
+ });
+ if (!statuses.some((status) => status.context === "license/cla" && status.state === "pending")) continue;
+
+ await github.rest.issues.createComment({
+ ...repo,
+ issue_number: pr.number,
+ body: "This pull request has been automatically closed because the CLA has not been signed for 7 days. Reopen it after signing.",
+ });
+ await github.rest.pulls.update({
+ ...repo,
+ pull_number: pr.number,
+ state: "closed",
+ });
+ }
+
- name: Mark and close stale pull requests
uses: actions/stale@v9
with: