Skip to content

Commit

Permalink
change api yml
Browse files Browse the repository at this point in the history
  • Loading branch information
alchem0x2A committed Jan 16, 2024
1 parent 670ab8b commit 92bdcc5
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions .github/workflows/update_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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 "[email protected]"
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 "[email protected]"
# 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 }}

0 comments on commit 92bdcc5

Please sign in to comment.