Update api spec #285
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: generate | |
permissions: | |
contents: write | |
on: | |
pull_request: | |
paths: | |
- 'Makefile' | |
- .github/workflows/generate.yml | |
- spec.json | |
- 'generate/**.go' | |
- VERSION.txt | |
workflow_dispatch: | |
inputs: | |
jobs: | |
format: | |
# Check if the PR is not from a fork | |
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.19.x' | |
- name: Run generate | |
shell: bash | |
run: | | |
export PATH=${PATH}:`go env GOPATH`/bin | |
make all | |
env: | |
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} | |
- name: Check for modified files | |
id: git-check | |
run: echo ::set-output name=modified::$(if git diff-index --ignore-submodules --quiet HEAD --; then echo "false"; else echo "true"; fi) | |
- name: Commit changes, if any | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git fetch origin | |
git commit -am "I have generated the latest API!" || true | |
git push origin ${{github.event.pull_request.head.ref }} || true |