Skip to content

feat: Public API, new namespace, disk actions, sort order, 503s, automated builds #28

feat: Public API, new namespace, disk actions, sort order, 503s, automated builds

feat: Public API, new namespace, disk actions, sort order, 503s, automated builds #28

Workflow file for this run

name: Build PHP client
on:
pull_request:
concurrency:
# On the main branch we want all builds to complete, even if new commits are merged.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'main')}}
jobs:
build-php:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Cache generator dependencies
uses: actions/cache@v4
with:
path: generator/vendor
key: ${{ runner.os }}-generator-vendor-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-generator-vendor-
- name: Generate our client
run: make build
# Commit all changed files back to the repository
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "feat(generator): new client automatically generated in GitHub Actions"
openapi:
runs-on: ubuntu-latest
steps:
- name: Check out the base branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
- name: Copy the spec files to /tmp for comparison
run: |
cp katapult-core-openapi.json /tmp/katapult-core-openapi.json
cp katapult-public-openapi.json /tmp/katapult-public-openapi.json
- name: Check out the current branch
uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node_modules-
- name: Install openapi-changes
run: npm install
- name: Test
run: npx openapi-changes summary --no-logo --no-color --markdown /tmp/katapult-core-openapi.json katapult-core-openapi.json
- name: Katapult Core API Spec Changes
id: core-changes
run: |
echo "core_changes<<EOF" >> $GITHUB_OUTPUT
npx openapi-changes summary --no-logo --no-color --markdown /tmp/katapult-core-openapi.json katapult-core-openapi.json >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Katapult Public API Spec Changes
id: public-changes
run: |
echo "public_changes<<EOF" >> $GITHUB_OUTPUT
npx openapi-changes summary --no-logo --no-color --markdown /tmp/katapult-public-openapi.json katapult-public-openapi.json >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Emit changes in GHA runs
run: echo ${{ steps.core-changes.outputs.core_changes }}
- name: Emit changes in GHA runs
run: echo ${{ steps.public-changes.outputs.public_changes }}
- name: Add/update a comment on the PR with the changes for the two APIs
uses: mshick/add-pr-comment@v2
with:
message: |
## Core API Changes
${{ steps.core-changes.outputs.core_changes || 'No changes.' }}
## Public API Changes
${{ steps.public-changes.outputs.public_changes || 'No changes.' }}