diff --git a/.github/workflows/update_api.yml b/.github/workflows/update_api.yml index a309b679..7af2c8ea 100644 --- a/.github/workflows/update_api.yml +++ b/.github/workflows/update_api.yml @@ -33,6 +33,9 @@ jobs: - name: Generate json api from github master run: | python -m sparc.docparser --git --include-subdirs + - name: Env variable for api version + run: | + echo "API_VERSION=$(python -c "from sparc.api import SparcAPI; print(SparcAPI('parameters.json').sparc_version))" >> $GITHUB_ENV - name: Test if json api is newer than current id: probe run: | @@ -41,29 +44,30 @@ jobs: - name: Create Pull Request if: steps.compare_versions.outputs.update_needed == 'true' run: | + git checkout -b api_version mv parameters.json sparc/sparc_json_api/ - gh pr create --title "[PR Bot] New JSON API version" -R alchem0x2a/SPARC-X-API - - name: Create badges - run: | - mkdir -p badges/ - # A coverage test badge - anybadge --value=$COVPERCENT --file=badges/coverage.svg coverage - # A version badge - PIPVER=`pip show sparc-x-api | grep Version | cut -d ' ' -f2` - anybadge --value=$PIPVER --file=badges/package.svg -l sparc-x-api - - name: Manually add git badges - run: | - # Assuming a badges branch already exists! - rm -rf /tmp/*.svg && cp badges/*.svg /tmp/ - git fetch - git switch badges || { echo "Could not check out badges branch. Have you created it on remote?"; exit 1; } - git pull - cp /tmp/*.svg badges/ && git add -f badges/*.svg && rm -rf /tmp/*.svg - git config --global user.email "alchem0x2a@gmail.com" - git config --global user.name "Github Action Bot (badges only)" - git commit -m "Update badges from run ${RID}" || true - git push -u origin badges || true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RID: ${{ github.run_id }} + gh pr create -B master --title "[PR Bot] New JSON API version ${API_VERSION}" -R alchem0x2a/SPARC-X-API + # - name: Create badges + # run: | + # mkdir -p badges/ + # # A coverage test badge + # anybadge --value=$COVPERCENT --file=badges/coverage.svg coverage + # # A version badge + # PIPVER=`pip show sparc-x-api | grep Version | cut -d ' ' -f2` + # anybadge --value=$PIPVER --file=badges/package.svg -l sparc-x-api + # - name: Manually add git badges + # run: | + # # Assuming a badges branch already exists! + # rm -rf /tmp/*.svg && cp badges/*.svg /tmp/ + # git fetch + # git switch badges || { echo "Could not check out badges branch. Have you created it on remote?"; exit 1; } + # git pull + # cp /tmp/*.svg badges/ && git add -f badges/*.svg && rm -rf /tmp/*.svg + # git config --global user.email "alchem0x2a@gmail.com" + # git config --global user.name "Github Action Bot (badges only)" + # git commit -m "Update badges from run ${RID}" || true + # git push -u origin badges || true + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # RID: ${{ github.run_id }}