-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (41 loc) · 1.13 KB
/
template_gen.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
40
41
42
43
44
name: Generate Templates
on:
pull_request:
branches: [ "master" ]
permissions: write-all
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.6
uses: actions/setup-python@v3
with:
python-version: "3.6"
- name: setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Checkout PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr checkout ${{ github.event.pull_request.number }}
- name: Run Template Gen
run: |
python3 generate_templates.py
- name: Git Add Templates
run: git add templates/.
- name: check for changes
run: |
if git diff --staged --exit-code; then
echo "changes_exist=false" >> "$GITHUB_ENV"
else
echo "changes_exist=true" >> "$GITHUB_ENV"
fi
- name: Git commit and push templates
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: env.changes_exist == 'true'
run: |
git commit -m "Autogenerated commit for templates"
git push