Repository navigation
ci: refresh the release PR on every push to main, without waiting for CI #454
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
Merged
Changes from all commits
Commits
Show all changes
2 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
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,68 @@ | ||
| # Refresh the open release PR as soon as a commit lands on main, instead of after release.yml's | ||
| # CI (about 30 minutes, longer when an earlier push's run is still queued in front of it). | ||
| # | ||
| # This is safe to run before the tests because it only rewrites the release PR. Nothing is | ||
| # tagged or published here (skip-github-release). A release is still cut only by release.yml, | ||
| # after CI has passed on the commit that merges the release PR, and that commit's tree holds | ||
| # every change the release contains. | ||
| # | ||
| # It is a workflow of its own because release.yml's workflow-level concurrency group queues a | ||
| # whole run behind the run before it: a job there would wait just as long. | ||
| # | ||
| # Two states in which the PR pass must not compute a PR, and what covers each: | ||
| # - The release PR is merged but release.yml has not cut its release yet. release-please sees | ||
| # the merged, untagged release PR and aborts on its own ("untagged, merged release PRs | ||
| # outstanding"). | ||
| # - The release is cut but still a draft (release.yml attaches its assets before publishing). | ||
| # A draft is invisible to release-please's "latest release" lookup, so it would compute the | ||
| # PR against the whole history. The check below skips the pass while a recent release is a | ||
| # draft; release.yml's release-please-pr job opens the next PR once publish-release has run. | ||
| name: Release PR | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| # Shared with release.yml's release-please-pr job, so the two never rewrite the PR branch at | ||
| # the same time. A newer push replaces a pending run; a running one finishes first. | ||
| concurrency: | ||
| group: release-pr-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| release-please-pr: | ||
| name: Release Please (PR) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| # contents: write also makes draft releases visible to the check below; a read-only | ||
| # token lists only published releases. | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - name: Check for an unpublished draft release | ||
| id: draft | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| # Only the draft release.yml has just cut misleads release-please, and it is the | ||
| # newest release, so the newest 20 always include it. Not paginated on purpose: a | ||
| # draft older than those cannot be that one, and would only block every refresh. | ||
| drafts=$(gh release list --repo "$GITHUB_REPOSITORY" --limit 20 --json tagName,isDraft \ | ||
| --jq '[.[] | select(.isDraft) | .tagName] | join(" ")') | ||
| if [[ -n "$drafts" ]]; then | ||
| echo "::notice::Draft release(s) not yet published: $drafts. release.yml refreshes the release PR after publish-release." | ||
| echo "skip=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Open or refresh the release PR | ||
| if: steps.draft.outputs.skip != 'true' | ||
| uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| config-file: release-please-config.json | ||
| manifest-file: .release-please-manifest.json | ||
| skip-github-release: true | ||
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
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.