-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (31 loc) · 1006 Bytes
/
sync.yml
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
name: Push to Main
on:
push:
branches:
- github
jobs:
push_to_main:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Authenticate
run: |
git config --global user.email "sentinel@inesctec.pt"
git config --global user.name "Sentinel"
- name: Check if main branch exists on remote
run: git ls-remote --exit-code --heads origin main || echo "::set-output name=branch_exists::false"
id: check_main_branch
- name: Create main branch if it doesn't exist
if: steps.check_main_branch.outputs.branch_exists == 'false'
run: |
git checkout -b main
git push origin main
- name: Fetch main branch
run: git fetch origin main
- name: Merge changes into main
run: |
git checkout main
git merge --no-ff ${{ github.ref }}
- name: Push changes to main
run: git push origin main