-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (40 loc) · 1.53 KB
/
push_autogen.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
name: Push changes to neurostuff-sdk-generator
on:
push:
branches:
- '**'
jobs:
update_generator:
runs-on: ubuntu-20.04
steps:
- name: Checkout Generator
uses: actions/checkout@v3
with:
repository: neurostuff/neurostuff-sdk-generator
submodules: true
token: ${{ secrets.SDK_PAT }}
- name: Change/Create branch
run: |
git fetch
git ls-remote --exit-code --heads origin ${{ github.ref_name }} || git branch ${{ github.ref_name }}
git checkout ${{ github.ref_name }}
- name: Checkout Specification
uses: actions/checkout@v3
with:
path: neurostore-spec
- name: Update Generator
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# check to see if there were any changes to the repository and no branches made
if [ -z $(git diff --submodule) ]; then
echo "no new changes in neurostore-spec"
if [ -z "$(git ls-remote --heads origin ${{ github.ref_name }})" ]; then
git push -q https://github.com/neurostuff/neurostuff-sdk-generator.git ${{ github.ref_name }}
else
echo "branch already exists and is up to date"
fi
else
git commit -m "${{ github.sha }}" -a
git push -q https://github.com/neurostuff/neurostuff-sdk-generator.git ${{ github.ref_name }}
fi