-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (40 loc) · 1.41 KB
/
generate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: generate
permissions:
contents: write
on:
pull_request:
paths:
- 'Makefile'
- .github/workflows/generate.yml
- 'spec.json'
- 'generate/generate.py'
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@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Run generate
shell: bash
run: |
make generate
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 add .
git commit -am "I have generated the latest API!" || true
git push origin ${{github.event.pull_request.head.ref }} || true