-
-
Notifications
You must be signed in to change notification settings - Fork 295
refactor: share is-release-pr check between changelog updates and stale closer #9685
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
Open
cryptodev-2s
wants to merge
2
commits into
chore/close-stale-release-prs
Choose a base branch
from
chore/share-is-release-pr-action
base: chore/close-stale-release-prs
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: Is release PR | ||
| description: > | ||
| Determine whether a pull request is a release PR using the same check as | ||
| update-changelogs (checkout head, merge-base, MetaMask/action-is-release). | ||
|
|
||
| inputs: | ||
| pr-number: | ||
| description: Pull request number to evaluate. | ||
| required: true | ||
| commit-starts-with: | ||
| description: > | ||
| Comma-separated commit/PR title prefixes. Use `[version]` for the new root | ||
| package version (same as vars.RELEASE_COMMIT_PREFIX). | ||
| required: true | ||
| token: | ||
| description: GitHub token for gh/API access. | ||
| required: false | ||
| default: ${{ github.token }} | ||
|
|
||
| outputs: | ||
| IS_RELEASE: | ||
| description: '"true" when the PR is a release PR, otherwise "false".' | ||
| value: ${{ steps.is-release.outputs.IS_RELEASE }} | ||
| head-sha: | ||
| description: Head commit SHA of the pull request. | ||
| value: ${{ steps.pr-info.outputs.pr-head-sha }} | ||
| head-ref: | ||
| description: Head branch name of the pull request. | ||
| value: ${{ steps.pr-info.outputs.pr-head-ref }} | ||
| base-ref: | ||
| description: Base branch name of the pull request. | ||
| value: ${{ steps.pr-info.outputs.pr-base-ref }} | ||
| merge-base: | ||
| description: Merge-base SHA between the PR head and base branch. | ||
| value: ${{ steps.merge-base.outputs.merge-base }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Get pull request info | ||
| id: pr-info | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ inputs.token }} | ||
| PR_NUMBER: ${{ inputs.pr-number }} | ||
| run: | | ||
| set -euo pipefail | ||
| gh pr view "$PR_NUMBER" \ | ||
| --repo "$GITHUB_REPOSITORY" \ | ||
| --json baseRefName,headRefOid,headRefName,title \ | ||
| --jq '"pr-base-ref=\(.baseRefName)\npr-head-sha=\(.headRefOid)\npr-head-ref=\(.headRefName)\npr-title=\(.title)"' \ | ||
| >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| token: ${{ inputs.token }} | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| ref: ${{ steps.pr-info.outputs.pr-head-sha }} | ||
|
|
||
| - name: Get merge base | ||
| id: merge-base | ||
| shell: bash | ||
| env: | ||
| BASE_REF: ${{ steps.pr-info.outputs.pr-base-ref }} | ||
| run: | | ||
| set -euo pipefail | ||
| MERGE_BASE=$(git merge-base HEAD "refs/remotes/origin/$BASE_REF") | ||
| echo "merge-base=$MERGE_BASE" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Check if the pull request is a release | ||
| id: is-release | ||
| uses: MetaMask/action-is-release@v2 | ||
| with: | ||
| commit-starts-with: ${{ inputs.commit-starts-with }} | ||
| commit-message: ${{ steps.pr-info.outputs.pr-title }} | ||
| before: ${{ steps.merge-base.outputs.merge-base }} | ||
| skip-checkout: 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
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.
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.