Last active
December 8, 2021 13:31
-
-
Save mstijak/fdb6b7621671f9442b96d3c8dbcae53d to your computer and use it in GitHub Desktop.
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: Publish PRs in the Dev branch for preview | |
on: | |
pull_request: | |
types: [opened, labeled, synchronize, reopened] | |
jobs: | |
merge-dev: | |
if: contains(github.event.pull_request.labels.*.name, 'DEV') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.DEV_DEPLOY_TOKEN }} | |
- name: Merge Script | |
run: | | |
git --version | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
git status | |
git fetch origin dev | |
git checkout dev | |
git pull | |
git merge origin/${{ github.head_ref }} --no-edit -m "Merge PR ${{ github.ref_name }} to the dev branch for preview" | |
git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Custom PAT token is required if this change needs to trigger the action to actually deploy the
dev
branch. Otherwise, linetoken: ${{ secrets.DEV_DEPLOY_TOKEN }}
can be omitted.