diff --git a/.github/workflows/apm-materialize.yml b/.github/workflows/apm-materialize.yml index e52532c8..f188b9e3 100644 --- a/.github/workflows/apm-materialize.yml +++ b/.github/workflows/apm-materialize.yml @@ -65,14 +65,12 @@ jobs: permission-pull-requests: write - name: Checkout main - # zizmor: ignore[artipacked] - # Persisted credentials are required: the open-pr step below pushes the - # materialize branch using the token checkout writes into the remote URL. - # This job runs no untrusted code — it installs the pinned apm CLI and - # runs `apm install` over the repo's own committed apm.yml. + # No persisted credentials: the open-pr step below commits through the + # GitHub API with its github-token (commit-method: api), not `git push`. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: token: ${{ steps.app-token.outputs.token }} + persist-credentials: false - name: Check for apm.yml id: precheck @@ -113,7 +111,7 @@ jobs: - name: Open materialize PR if: steps.precheck.outputs.skip != 'true' # renovate: datasource=github-tags depName=DevSecNinja/.github - uses: DevSecNinja/.github/actions/open-pr@9c281b38f863550ddff25df04e6fda0b9b23d00c # v3.3.0 + uses: DevSecNinja/.github/actions/open-pr@5cee546e22e862a82f74e8dda800d439b9af537c # v4.1.0 with: branch: chore/apm-materialize base: main @@ -121,6 +119,7 @@ jobs: commit-message: "chore: materialize APM primitives from apm.yml" labels: apm-sync github-token: ${{ steps.app-token.outputs.token }} + commit-method: api # Stage the lockfile and deployed harness files. apm.yml itself is # unchanged (already on main); apm_modules/ is gitignored. if-no-changes: skip diff --git a/.github/workflows/apm-sync.yml b/.github/workflows/apm-sync.yml index 5304a043..efc810c4 100644 --- a/.github/workflows/apm-sync.yml +++ b/.github/workflows/apm-sync.yml @@ -155,17 +155,13 @@ jobs: permission-pull-requests: write - name: Checkout calling repository - # zizmor: ignore[artipacked] - # Persisted credentials are required: the `actions/open-pr` step below - # invokes `git push --force-with-lease`, which relies on the bearer - # token that `actions/checkout` writes into the remote URL. Setting - # `persist-credentials: false` here breaks PR creation without offering - # meaningful isolation — this job runs no untrusted code (it only - # installs the pinned apm CLI and runs `apm update` over the repo's own - # committed apm.yml/apm.lock.yaml). + # No persisted credentials: the `actions/open-pr` step below commits + # through the GitHub API with its github-token (commit-method: api), + # not `git push`. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: token: ${{ steps.app-token.outputs.token || github.token }} + persist-credentials: false - name: Check for apm.yml id: precheck @@ -202,7 +198,7 @@ jobs: id: open-pr if: steps.precheck.outputs.skip != 'true' # renovate: datasource=github-tags depName=DevSecNinja/.github - uses: DevSecNinja/.github/actions/open-pr@9c281b38f863550ddff25df04e6fda0b9b23d00c # v3.3.0 + uses: DevSecNinja/.github/actions/open-pr@5cee546e22e862a82f74e8dda800d439b9af537c # v4.1.0 with: branch: ${{ inputs.pr-branch }} base: ${{ inputs.target-branch }} @@ -210,6 +206,7 @@ jobs: commit-message: "chore: sync APM primitives from upstream packages" labels: apm-sync github-token: ${{ steps.app-token.outputs.token || github.token }} + commit-method: api body: |- Automated PR — refreshed APM primitives via `apm update`. diff --git a/.github/workflows/config-sync.yml b/.github/workflows/config-sync.yml index 0f65147d..f1c3f442 100644 --- a/.github/workflows/config-sync.yml +++ b/.github/workflows/config-sync.yml @@ -142,17 +142,13 @@ jobs: permission-contents: write permission-pull-requests: write - name: Checkout calling repository - # zizmor: ignore[artipacked] - # Persisted credentials are required: the `actions/open-pr` step - # below invokes `git push` which relies on the bearer token that - # `actions/checkout` writes into the remote URL. Setting - # `persist-credentials: false` here breaks PR creation without - # offering meaningful isolation, since this job never executes - # content fetched from the central repo (it only reads files - # from `.config-sync-source/` to copy them). + # No persisted credentials: the `actions/open-pr` step below commits + # through the GitHub API with its github-token (commit-method: api), + # not `git push`. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: token: ${{ steps.app-token.outputs.token || github.token }} + persist-credentials: false - name: Checkout central config source uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -401,13 +397,14 @@ jobs: fi - name: Create PR if configs changed if: steps.pull.outputs.updated == '1' - uses: DevSecNinja/.github/actions/open-pr@9c281b38f863550ddff25df04e6fda0b9b23d00c # v3.3.0 + uses: DevSecNinja/.github/actions/open-pr@5cee546e22e862a82f74e8dda800d439b9af537c # v4.1.0 with: branch: chore/config-sync title: 'chore: sync config files from central repo' commit-message: 'chore: sync config files from DevSecNinja/.github' labels: config-sync github-token: ${{ steps.app-token.outputs.token || github.token }} + commit-method: api body: |- Automated PR — config files pulled from [DevSecNinja/.github](https://github.com/DevSecNinja/.github/tree/main/config-sync) diff --git a/docs/automation-app.md b/docs/automation-app.md index e9de1f66..0db823fd 100644 --- a/docs/automation-app.md +++ b/docs/automation-app.md @@ -14,6 +14,11 @@ opens a pull request: See [ADR 0011](design-decisions/0011-single-automation-github-app.md) for the decision. +The three PR workflows commit through the GitHub API (`open-pr` with +`commit-method: api`), so GitHub signs their commits and the PRs pass a +"require signed commits" ruleset without an admin bypass. That holds for the +`GITHUB_TOKEN` fallback too. + ## Why an App instead of `GITHUB_TOKEN` - **Pull requests and tags made with `GITHUB_TOKEN` do not trigger