Last active
January 20, 2024 05:14
-
-
Save PatelUtkarsh/d1966b63c193a39a5e32f76e3cf12a11 to your computer and use it in GitHub Desktop.
Auto merge PR on adding label and trigger deployment if the branch supports it. Must have PAT(Personal access token) added to GH action.
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
name: Auto Merge and Push on Label | |
on: | |
pull_request_target: | |
types: [labeled] | |
jobs: | |
auto-merge-and-push: | |
runs-on: ubuntu-latest | |
if: github.event.label.name == 'In dev' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Merge PR | |
run: | | |
git config --global user.name 'CI' | |
git config --global user.email '[email protected]' | |
git fetch origin | |
git checkout develop | |
git merge --no-ff ${{ github.head_ref }} -m "Merging PR #${{ github.event.pull_request.number }}" | |
git push origin develop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment