Skip to content

re-run ci

re-run ci #220

Workflow file for this run

name: Publish Swagger Specs
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Cache
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
- name: Run Swagger Publisher
run: ./gradlew test --tests uk.gov.hmcts.reform.rhubarb.recipes.SwaggerPublisher
- name: Commit to repository
run: |
mkdir swagger-staging
cd swagger-staging
git init
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git remote add upstream https://${{ secrets.SWAGGER_PUBLISHER_API_TOKEN }}@github.com/hmcts/reform-api-docs.git
git pull upstream master
repo=`echo "$GITHUB_REPOSITORY" | cut -f2- -d/`
echo "$(cat /tmp/swagger-specs.json)" > "docs/specs/$repo.json"
git add "docs/specs/$repo.json"
# Only commit and push if we have changes.
git diff --quiet && git diff --staged --quiet || (git commit -m "Update spec for $repo#${GITHUB_SHA:7}"; git push --set-upstream upstream master)