chore: harden GA workflow files - #412
Closed
Florence-Njeri wants to merge 3 commits into
Closed
Conversation
Florence-Njeri
requested review from
Shurtu-gal,
asyncapi-bot-eve and
derberg
as code owners
August 11, 2026 14:49
| startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || | ||
| startsWith(github.event.pull_request.title, 'chore(release):') | ||
| )) || | ||
| (github.actor == 'allcontributors[bot]' && |
Comment on lines
+3
to
+6
| on: | ||
| workflow_run: | ||
| workflows: ["Docs Preview Build (Netlify)"] | ||
| types: [completed] |
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write # only for the comment step |
Comment on lines
+3
to
+6
| on: | ||
| pull_request_target: | ||
| types: | ||
| - opened |
| node-version: ${{ vars.NODE_VERSION }} | ||
|
|
||
| - name: Use Node.js | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.2.0 https://github.com/actions/setup-node/commit/48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e |
| # Revokes default permissions since all jobs only need read access. | ||
| permissions: {} | ||
| jobs: | ||
| changes: |
| persist-credentials: false # read-only; only used to access .github/pr-review-checklist.md | ||
|
|
||
| - name: Post initial PR checklist | ||
| uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 #v4.0.0 https://github.com/peter-evans/create-or-update-comment/releases/tag/v4.0.0 |
Comment on lines
+1
to
+32
| name: PR Review Checklist | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: | ||
| - opened | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| pr-review-list: | ||
| name: Post PR Review Checklist | ||
| # it runs only if PR actor is not a bot, at least not a bot that we know | ||
| if: | | ||
| (github.event.pull_request.user.login != 'asyncapi-bot' && | ||
| github.event.pull_request.user.login != 'dependabot[bot]' && | ||
| github.event.pull_request.user.login != 'dependabot-preview[bot]') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: write # permission to create-or-update-comment posts to the PR thread | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false # read-only; only used to access .github/pr-review-checklist.md | ||
|
|
||
| - name: Post initial PR checklist | ||
| uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 #v4.0.0 https://github.com/peter-evans/create-or-update-comment/releases/tag/v4.0.0 | ||
| with: | ||
| token: ${{ secrets.GH_TOKEN }} | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| body-path: '.github/pr-review-checklist.md' No newline at end of file |
| actions: read # to download artifacts from the triggering run | ||
|
|
||
| jobs: | ||
| deploy: |
| - name: Assets generation | ||
| run: npm run generate:assets --if-present | ||
| - name: Create Pull Request with updated asset files including package.json | ||
| uses: peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # use 4.2.4 https://github.com/peter-evans/create-pull-request/releases/tag/v4.2.4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
workflow_dispatch:trigger to all workflows to allow manual re-runs without waiting for a push eventpermissions: {}at workflow level with minimal job-level scopes to fix excessive-permissions (without this block, workflows inherit write-all permissions from the parent token)persist-credentials: falseon read-only checkouts; kepttrueonly wheregit pushis requiredhttps://${{ env.GITHUB_TOKEN }}.github.) withgit push origin HEADto prevent token exposure in logs and process listings (template-injection)github.shaandgithub.run_idexpansions intoenv:vars to keep shell steps injection-safegit configto the repository instead of--globalinupdate-docs-in-website.ymlmanual_netlify_preview.ymlworkflow into a two-stage build + deploy pattern (manual_netlify_preview.yml) following GitHub's hardened workflow best practices to eliminatepwn_requestrisks — the deploy stage runs under a protected environment (docs-preview) that requires maintainer approval before secrets are exposedWorkflows that were edited:
local-generate-files.yml— autogenerate API asset files on releasemanual_netlify_preview.yml— secure two-stage Netlify docs preview deploy (triggered viaworkflow_run)pr-review-checklist.yml— post PR review checklist with least-privilege permissionspr-testing-with-test-project.yml— integration and acceptance tests with scoped job permissionsrelease-with-changesets.yml— changeset-based release workflow with deny-all workflow tokenupdate-docs-in-website.yml— sync generator docs to asyncapi/website via hardened checkoutupdate-maintainers.yml— updateMAINTAINERS.yamlwith deny-all built-in token; uses PAT for cross-repo writesverify-docs-up-to-date.yml— verify generated docs have no drift on PRsRelated issue(s)
TBC