-
Notifications
You must be signed in to change notification settings - Fork 10
Add merge command for release branches #614
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
5 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 |
|---|---|---|
|
|
@@ -26,8 +26,6 @@ | |
| - on pull_request update | ||
| - from `/check` comment | ||
|
|
||
| ## Tag | ||
|
|
||
| ## Version | ||
|
|
||
| ## Release (`release.yml`) | ||
|
|
||
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,96 @@ | ||
| name: command merge | ||
|
|
||
| on: | ||
| repository_dispatch: | ||
| types: [merge-command] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| merge: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout target branch | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: refs/heads/${{ github.event.client_payload.pull_request.head.ref }} | ||
| token: ${{ secrets.REPOSITORY_WRITE_PAT }} | ||
|
|
||
| - name: Fail if not on release branch | ||
| if: (!startsWith(github.event.client_payload.pull_request.head.ref, 'release/v')) | ||
| run: | | ||
| echo "This command can only be run on release/v* branches." | ||
| exit 1 | ||
|
|
||
| - name: Configure git for PAT | ||
| run: | | ||
| git config user.name "ReleaseBot" | ||
| git config user.email "[email protected]" | ||
| git remote set-url origin https://x-access-token:${{ secrets.REPOSITORY_WRITE_PAT }}@github.com/${{ github.repository }}.git | ||
|
|
||
| - name: Fetch main branch version.json | ||
| run: | | ||
| git fetch origin main | ||
| git checkout origin/main -- version.json | ||
|
|
||
| - name: Commit version.json from main | ||
| run: | | ||
| git add version.json | ||
| if git diff-index --quiet HEAD -- version.json; then | ||
| echo "No changes to commit" | ||
| else | ||
| git commit -m "Update version.json from main before merge" | ||
| fi | ||
| git push origin HEAD | ||
|
|
||
| - name: Check PR status checks | ||
| run: | | ||
| gh auth login --with-token <<< "${{ secrets.REPOSITORY_WRITE_PAT }}" | ||
|
|
||
| # Verify all checks passed | ||
| STATUS=$(gh pr view ${{ github.event.client_payload.pull_request.number }} --json statusCheckRollup --jq '.statusCheckRollup[] | select(.conclusion != "SUCCESS" and .conclusion != "SKIPPED" and .conclusion != null) | .conclusion') | ||
|
|
||
| if [ ! -z "$STATUS" ]; then | ||
| echo "Not all status checks have passed. Cannot merge." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Merge Pull Request | ||
| run: | | ||
| gh auth login --with-token <<< "${{ secrets.REPOSITORY_WRITE_PAT }}" | ||
| gh pr merge ${{ github.event.client_payload.pull_request.number }} --merge --auto | ||
|
|
||
| success: | ||
| needs: | ||
| - merge | ||
| runs-on: ubuntu-latest | ||
| if: success() | ||
| steps: | ||
| - name: Add reaction | ||
| uses: peter-evans/create-or-update-comment@v4 | ||
| with: | ||
| repository: ${{ github.event.client_payload.github.payload.repository.full_name }} | ||
| comment-id: ${{ github.event.client_payload.github.payload.comment.id }} | ||
| reactions: hooray | ||
| reactions-edit-mode: replace | ||
|
|
||
| failure: | ||
| needs: | ||
| - merge | ||
| runs-on: ubuntu-latest | ||
| if: failure() | ||
| steps: | ||
| - name: Add reaction | ||
| uses: peter-evans/create-or-update-comment@v4 | ||
| with: | ||
| repository: ${{ github.event.client_payload.github.payload.repository.full_name }} | ||
| comment-id: ${{ github.event.client_payload.github.payload.comment.id }} | ||
| reactions: confused | ||
| reactions-edit-mode: replace | ||
| edit-mode: replace | ||
| body: | | ||
| /${{ github.event.client_payload.slash_command.command }} ${{ github.event.client_payload.slash_command.args.all }} | ||
| [](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | ||
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
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,15 @@ | ||
| name: Manual merging | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| branches-ignore: "release/v*" | ||
|
|
||
| # This action will only run on non release branches | ||
| # We have setup this check as a requirement for merging | ||
| # That way release branches can not be manually merged because this check will always be in the waiting state | ||
| jobs: | ||
| noop: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: No-op step | ||
| run: echo 'No-op job' |
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 |
|---|---|---|
|
|
@@ -27,3 +27,4 @@ jobs: | |
| release | ||
| version | ||
| check | ||
| merge | ||
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.