From b0bf9287fa98893218bfabd72e9bc0c0f1d81d35 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 9 Nov 2026 13:18:34 -0500 Subject: [PATCH 1/4] Run the CLA check without pull_request_target GitHub blocks pull_request_target by default in public repositories without an Actions event policy. A secret-free CLA trigger workflow runs on pull_request; when it completes, the CLA workflow runs from main on workflow_run and sets a cla commit status on the pull request's head. --- .github/workflows/cla-trigger.yml | 16 ++++++++++++++++ .github/workflows/cla.yml | 25 ++++++++++++++----------- docs/licensing.md | 4 ++-- 3 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/cla-trigger.yml diff --git a/.github/workflows/cla-trigger.yml b/.github/workflows/cla-trigger.yml new file mode 100644 index 0000000..e0f11ae --- /dev/null +++ b/.github/workflows/cla-trigger.yml @@ -0,0 +1,16 @@ +name: CLA trigger + +on: + pull_request: + types: [opened, reopened, synchronize] + +permissions: {} + +jobs: + # Its completion starts the CLA workflow, which checks the pull request with the signature App. + # Not named `cla`: a check with that name here would satisfy the required `cla` status. + trigger: + runs-on: ubuntu-24.04 + timeout-minutes: 1 + steps: + - run: echo "The CLA workflow checks this pull request when this run completes." diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 2d4acb3..c4d7678 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -1,28 +1,28 @@ name: CLA on: + workflow_run: + workflows: [CLA trigger] + types: [completed] issue_comment: types: [created] - pull_request_target: - types: [opened, reopened, synchronize] permissions: {} jobs: - cla: - # Dependabot-triggered runs cannot access the App secret; human updates and rechecks still run. + # Reports a `cla` commit status on the pull request's head; this job's own check lands on main. + check: if: | - github.actor != 'dependabot[bot]' && - (github.event_name == 'pull_request_target' || - (github.event_name == 'issue_comment' && github.event.issue.pull_request && - github.event.comment.user.type != 'Bot' && - (contains(github.event.comment.body, 'CLA') || contains(github.event.comment.body, 'recheck')))) + (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && + github.event.comment.user.type != 'Bot' && + (contains(github.event.comment.body, 'CLA') || contains(github.event.comment.body, 'recheck'))) runs-on: ubuntu-24.04 timeout-minutes: 5 permissions: - actions: write contents: read pull-requests: write + statuses: write steps: # This privileged workflow must never check out or execute pull-request code. - name: Create signature writer token @@ -34,11 +34,14 @@ jobs: owner: ${{ github.repository_owner }} repositories: ${{ github.event.repository.name }} permission-single-file: write - - uses: openwatersio/cla-github-action@599be7e585704b7eb53be7498aebefc0e7d8caac # Open Waters fork + - uses: openwatersio/cla-github-action@82b776f1896ffd2631594b92ea124e173609e496 # Open Waters fork env: GITHUB_TOKEN: ${{ github.token }} PERSONAL_ACCESS_TOKEN: ${{ steps.cla-token.outputs.token }} with: + # The open pull request whose head is this commit is checked; nothing from the triggering run is trusted. + head-sha: ${{ github.event.workflow_run.head_sha }} + status-context: cla path-to-document: "https://github.com/${{ github.repository }}/blob/main/CLA.md" path-to-signatures: ".cla.json" branch: "main" diff --git a/docs/licensing.md b/docs/licensing.md index c52b09a..4d262e8 100644 --- a/docs/licensing.md +++ b/docs/licensing.md @@ -39,9 +39,9 @@ Signal (AGPLv3) uses this exact approach to distribute on the iOS App Store. The The CLA workflow records signatures in `.cla.json` on `main` using the organization-owned Open Waters CLA App. The App has Single file write permission for `.cla.json` and Metadata read permission. It needs a bypass in any ruleset that would reject its signature commits; the ordinary GitHub Actions token does not need a bypass. -Maintainers configure the organization variable `CLA_APP_CLIENT_ID` and encrypted Actions secret `CLA_APP_PRIVATE_KEY`, restricted to the participating repositories. The workflow creates a short-lived token scoped to this repository. Never check out or execute pull-request code in this privileged workflow. See the [shared setup guide](https://github.com/openwatersio/cla-github-action/blob/master/docs/open-waters.md). +Maintainers configure the organization variable `CLA_APP_CLIENT_ID` and encrypted Actions secret `CLA_APP_PRIVATE_KEY`, restricted to the participating repositories. The workflow creates a short-lived token scoped to this repository. Never check out or execute pull-request code in the privileged CLA workflow. See the [shared setup guide](https://github.com/openwatersio/cla-github-action/blob/master/docs/open-waters.md). -Human comments mentioning the CLA or `recheck` reach the action's signing-text validation. Dependabot-initiated runs are skipped because Actions secrets are unavailable; human updates and recheck comments still run. Claude co-author metadata is exempt, while human contributors must sign. If storage rejects a write, the check fails; comment `recheck` to retry. The workflow result and `.cla.json` are authoritative even if a bot comment has already acknowledged signing. +Each pull request runs the secret-free `CLA trigger` workflow. When it completes, the CLA workflow runs from `main`, checks the open pull request whose head is that commit, and sets a `cla` commit status on it. Human comments mentioning the CLA or `recheck` reach the action's signing-text validation and update the status. Claude co-author metadata is exempt, while human contributors must sign. If storage rejects a write, the check fails; comment `recheck` to retry. The workflow result and `.cla.json` are authoritative even if a bot comment has already acknowledged signing. ## References From 33d46349c283e2609f6488db04438a4dc775a725 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 9 Nov 2026 13:21:48 -0500 Subject: [PATCH 2/4] Keep Dependabot pull requests mergeable under the CLA check Dependabot's runs may not get the App secret. Its trigger job is named cla and passes, as the skipped cla job did before, and the CLA workflow skips those runs. --- .github/workflows/cla-trigger.yml | 4 +++- .github/workflows/cla.yml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cla-trigger.yml b/.github/workflows/cla-trigger.yml index e0f11ae..3c1faec 100644 --- a/.github/workflows/cla-trigger.yml +++ b/.github/workflows/cla-trigger.yml @@ -8,8 +8,10 @@ permissions: {} jobs: # Its completion starts the CLA workflow, which checks the pull request with the signature App. - # Not named `cla`: a check with that name here would satisfy the required `cla` status. + # Not named `cla`, since a check with that name would satisfy the required `cla` status, except + # on Dependabot's own runs: the CLA workflow skips those, and its PRs need no signature. trigger: + name: ${{ github.actor == 'dependabot[bot]' && 'cla' || 'trigger' }} runs-on: ubuntu-24.04 timeout-minutes: 1 steps: diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index c4d7678..801bcfb 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -13,7 +13,8 @@ jobs: # Reports a `cla` commit status on the pull request's head; this job's own check lands on main. check: if: | - (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') || + (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.actor.login != 'dependabot[bot]') || (github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.user.type != 'Bot' && (contains(github.event.comment.body, 'CLA') || contains(github.event.comment.body, 'recheck'))) From fcad64ece5731840fe7b2b00a7b3165287169b21 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 9 Nov 2026 13:42:09 -0500 Subject: [PATCH 3/4] Name the cla status as the authoritative CLA result --- docs/licensing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/licensing.md b/docs/licensing.md index 4d262e8..94032ab 100644 --- a/docs/licensing.md +++ b/docs/licensing.md @@ -41,7 +41,7 @@ The CLA workflow records signatures in `.cla.json` on `main` using the organizat Maintainers configure the organization variable `CLA_APP_CLIENT_ID` and encrypted Actions secret `CLA_APP_PRIVATE_KEY`, restricted to the participating repositories. The workflow creates a short-lived token scoped to this repository. Never check out or execute pull-request code in the privileged CLA workflow. See the [shared setup guide](https://github.com/openwatersio/cla-github-action/blob/master/docs/open-waters.md). -Each pull request runs the secret-free `CLA trigger` workflow. When it completes, the CLA workflow runs from `main`, checks the open pull request whose head is that commit, and sets a `cla` commit status on it. Human comments mentioning the CLA or `recheck` reach the action's signing-text validation and update the status. Claude co-author metadata is exempt, while human contributors must sign. If storage rejects a write, the check fails; comment `recheck` to retry. The workflow result and `.cla.json` are authoritative even if a bot comment has already acknowledged signing. +Each pull request runs the secret-free `CLA trigger` workflow. When it completes, the CLA workflow runs from `main`, checks the open pull request whose head is that commit, and sets a `cla` commit status on it. Human comments mentioning the CLA or `recheck` reach the action's signing-text validation and update the status. Claude co-author metadata is exempt, while human contributors must sign. If storage rejects a write, the `cla` status reports an error; comment `recheck` to retry. The `cla` status and `.cla.json` are authoritative even if a bot comment has already acknowledged signing. An unsigned result shows only in the status, not as a failed CLA workflow run. ## References From 2c8e43dfc0ff44b6b45fe354f2f30ed3eb528d57 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Tue, 10 Nov 2026 14:04:26 -0500 Subject: [PATCH 4/4] Pin the CLA action to its merged release --- .github/workflows/cla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 801bcfb..31078b2 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -35,7 +35,7 @@ jobs: owner: ${{ github.repository_owner }} repositories: ${{ github.event.repository.name }} permission-single-file: write - - uses: openwatersio/cla-github-action@82b776f1896ffd2631594b92ea124e173609e496 # Open Waters fork + - uses: openwatersio/cla-github-action@f07dfd38224fde9ace8e7b8437ba318e0db042ea # Open Waters fork env: GITHUB_TOKEN: ${{ github.token }} PERSONAL_ACCESS_TOKEN: ${{ steps.cla-token.outputs.token }}