Modified neurosynth-compose-openapi.yml #325
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |