-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (35 loc) · 1.11 KB
/
sync-master-staging.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# This is a workflow for GitHub Actions to automatically
# sync code from the master branch to "master-staging".
# This is to allow Vercel to run preview deployments (for testing)
# on master-staging since Vercel does not allow preview branches
# on master.
name: Sync master to master-staging
permissions:
contents: write
on:
push:
branches:
- master
pull_request:
branches:
- master
types:
- closed
jobs:
sync-branches:
if: github.event.pull_request.merged == true || github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
uses: actions/checkout@v3
with:
ref: master
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Sync with master-staging
run: |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git checkout -B master-staging
git push origin master-staging --force