Skip to content

Commit

Permalink
chore: Auto merge cherry picked commits to dev (#16611)
Browse files Browse the repository at this point in the history
* chore: Auto merge cherry picked commits to dev

* fix naming

* fix target

* fix naming
  • Loading branch information
atomrc committed Jan 24, 2024
1 parent 850763f commit e46cfcf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/cherry-pick-release-to-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ jobs:
pr_branch: 'dev'
env:
GITHUB_TOKEN: ${{ secrets.OTTO_THE_BOT_GH_TOKEN }}

# Add the auto-merge flag
- name: Enable auto-merge
run: gh pr edit ${{ github.event.pull_request.id }} --add-label auto-merge
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.WEBTEAM_AUTOMERGE_TOKEN}}
11 changes: 3 additions & 8 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@ jobs:
with:
github-token: '${{secrets.WEBTEAM_AUTOMERGE_TOKEN}}'

- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.WEBTEAM_AUTOMERGE_TOKEN}}

- name: Enable auto-merge for Dependabot PRs
# Add the auto-merge flag if the PR is a minor or patch version update
- name: Enable auto-merge for minor and patch updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --squash "$PR_URL"
run: gh pr edit ${{ github.event.pull_request.id }} --add-label auto-merge
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.WEBTEAM_AUTOMERGE_TOKEN}}
26 changes: 26 additions & 0 deletions .github/workflows/pr-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: auto-merge flagged PR
on:
pull_request:
types: ['labeled']

permissions:
pull-requests: write
contents: write

## This job will auto merge PR that has been labeled with 'auto-merge'
jobs:
activate-auto-merge:
runs-on: ubuntu-latest
if: ${{ github.event.label.name == 'auto-merge' }}
steps:
- name: Approve PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.WEBTEAM_AUTOMERGE_TOKEN}}

- name: Enable auto-merge
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.WEBTEAM_AUTOMERGE_TOKEN}}

0 comments on commit e46cfcf

Please sign in to comment.