-
Notifications
You must be signed in to change notification settings - Fork 196
feat(ci): auto-trigger make-release and docs rebuild on PR merge #5487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+114
−7
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: Auto-trigger docs rebuild on layer ARN docs PR merge | ||
|
|
||
| # PROCESS | ||
| # | ||
| # This workflow watches for `publish_layer.yml`'s `update_layer_arn_docs` job PR (branch | ||
| # `ci-layer-docs-<run_id>`) merging to `main` so it can dispatch `rebuild_latest_docs.yml` | ||
| # automatically, leaving only the human action that requires actual review: approving the | ||
| # ARN-doc PR. | ||
| # | ||
| # SECURITY NOTE | ||
| # | ||
| # Deliberately uses `pull_request` (not `pull_request_target`), so PRs from forks keep | ||
| # GitHub's default read-only token and no secrets - a forked PR could never reach the | ||
| # `gh workflow run` step even if every other condition below matched. | ||
| # | ||
| # `github.event.pull_request.user.login` is set by GitHub from the identity that actually | ||
| # called the API to open the PR - it isn't spoofable via branch name, PR title, or body. | ||
| # `ci-layer-docs-*` PRs are opened by aws-powertools/actions' `create-pr` action using the | ||
| # default `GITHUB_TOKEN`, so `.user.login` is always `github-actions[bot]` (confirmed | ||
| # against real PR history - this is NOT the same as `aws-powertools-bot`, which is only | ||
| # the git commit-author identity `create-pr` sets locally via `git config`, not what | ||
| # GitHub exposes as the PR's author). | ||
| # | ||
| # Combined with `head.repo.full_name == github.repository` (rejects forks explicitly) | ||
| # and `base.ref == 'main'`, only genuine automation-opened, same-repo, main-targeted | ||
| # PRs can reach the dispatch step. | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| trigger-rebuild-docs: | ||
| if: > | ||
| github.event.pull_request.merged == true && | ||
| github.event.pull_request.base.ref == 'main' && | ||
| github.event.pull_request.head.repo.full_name == github.repository && | ||
| github.event.pull_request.user.login == 'github-actions[bot]' && | ||
| startsWith(github.event.pull_request.head.ref, 'ci-layer-docs-') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| actions: write | ||
| steps: | ||
| - name: Checkout main | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| ref: main | ||
| - name: Resolve latest published version | ||
| id: version | ||
| run: echo "version=$(cat packages/commons/package.json | jq .version -r)" >> "$GITHUB_OUTPUT" | ||
| - name: Dispatch Rebuild latest docs | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| VERSION: ${{ steps.version.outputs.version }} | ||
| run: gh workflow run rebuild_latest_docs.yml --repo ${{ github.repository }} --ref main --field latest_published_version="$VERSION" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Auto-trigger Make Release on version bump PR merge | ||
|
|
||
| # PROCESS | ||
| # | ||
| # This workflow watches for `make-version.yml`'s version-bump PR (branch `ci-bump-<run_id>`) | ||
| # merging to `main` so it can dispatch `make-release.yml` automatically, leaving only the | ||
| # human actions that require actual review: approving the version PR and approving npm | ||
| # publish. | ||
| # | ||
| # SECURITY NOTE | ||
| # | ||
| # Deliberately uses `pull_request` (not `pull_request_target`), so PRs from forks keep | ||
| # GitHub's default read-only token and no secrets - a forked PR could never reach the | ||
| # `gh workflow run` step even if every other condition below matched. | ||
| # | ||
| # `github.event.pull_request.user.login` is set by GitHub from the identity that actually | ||
| # called the API to open the PR - it isn't spoofable via branch name, PR title, or body. | ||
| # `ci-bump-*` PRs are opened by aws-powertools/actions' `create-pr` action using the | ||
| # default `GITHUB_TOKEN`, so `.user.login` is always `github-actions[bot]` (confirmed | ||
| # against real PR history - this is NOT the same as `aws-powertools-bot`, which is only | ||
| # the git commit-author identity `create-pr` sets locally via `git config`, not what | ||
| # GitHub exposes as the PR's author). | ||
| # | ||
| # Combined with `head.repo.full_name == github.repository` (rejects forks explicitly) | ||
| # and `base.ref == 'main'`, only genuine automation-opened, same-repo, main-targeted | ||
| # PRs can reach the dispatch step. | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| trigger-make-release: | ||
| if: > | ||
| github.event.pull_request.merged == true && | ||
| github.event.pull_request.base.ref == 'main' && | ||
| github.event.pull_request.head.repo.full_name == github.repository && | ||
| github.event.pull_request.user.login == 'github-actions[bot]' && | ||
| startsWith(github.event.pull_request.head.ref, 'ci-bump-') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| actions: write | ||
| steps: | ||
| - name: Dispatch Make Release | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: gh workflow run make-release.yml --repo ${{ github.repository }} --ref main |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.