Skip to content

Fixed nightly test configuration (#883) #697

Fixed nightly test configuration (#883)

Fixed nightly test configuration (#883) #697

Workflow file for this run

name: Publish Swagger Specs
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Cache
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Run Swagger Publisher
run: ./gradlew integration --tests uk.gov.hmcts.reform.iacasedocumentsapi.config.OpenApiPublisher
- name: Commit to repository
run: |
mkdir swagger-staging
cd swagger-staging
git init
git config user.email "github-actions@users.noreply.github.com"
git config user.name "IAC Case Documents"
git remote add upstream "https://jenkins-reform-hmcts:${{ 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)