-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (37 loc) · 1.31 KB
/
rebase-includes.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: My Workflow
on: [push, pull_request]
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run a one-line script
run: python ./.github/workflows/rebase-includes.py
- name: setup git config
run: |
# setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
- name: check for changes
id: check_changes
run: |
git status
if [[ `git status --porcelain` ]]; then
echo "Files have been changed."
echo "::set-output name=has_changes::true"
else
echo "::set-output name=has_changes::false"
fi
- name: stage changed files
if: steps.check_changes.outputs.has_changes == 'true'
run: git add .
- name: commit changed files
if: steps.check_changes.outputs.has_changes == 'true'
run: git commit -m "Rebasing includes"
- name: fetch from main
if: steps.check_changes.outputs.has_changes == 'true'
run: git fetch origin main
- name: push code to main
if: steps.check_changes.outputs.has_changes == 'true'
run: git push origin HEAD:main