-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (41 loc) · 1.5 KB
/
push_changes_to_spec.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
name: Push changes to neurostore-spec
on:
push:
branches:
- '**'
- '!gh-pages'
jobs:
update_specification:
runs-on: ubuntu-20.04
steps:
- name: Checkout Specification
uses: actions/checkout@v3
with:
repository: neurostuff/neurostore-spec
submodules: true
token: ${{ secrets.ADMIN_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 nimads
uses: actions/checkout@v3
with:
path: nimads
- name: Update specification
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 nimads"
if [ -z "$(git ls-remote --heads origin ${{ github.ref_name }})" ]; then
git push -q https://github.com/neurostuff/neurostore-spec.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/neurostore-spec.git ${{ github.ref_name }}
fi