add more messafges #19
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
on: | |
push: | |
branches: | |
- main | |
paths: | |
- openapi/api.json | |
pull_request: | |
paths: | |
- .github/workflows/update-spec-for-repos.yml | |
workflow_dispatch: | |
name: update spec for repos | |
concurrency: | |
group: repos-spec-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
update-spec: | |
strategy: | |
matrix: | |
repo: [modeling-app] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
# required | |
app-id: ${{ secrets.GH_ORG_APP_ID }} | |
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }} | |
owner: ${{ github.repository_owner }} | |
- uses: actions/checkout@v4 | |
# Checkout the repo since we will want to update the file there. | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'kittycad/${{ matrix.repo }}' | |
path: ${{ matrix.repo }} | |
token: ${{ steps.app-token.outputs.token }} | |
- name: move spec to repo | |
shell: bash | |
run: | | |
rm ${{ matrix.repo }}/openapi/machine-api.json || true | |
mkdir -p ${{ matrix.repo }}/openapi | |
cp openapi/api.json ${{ matrix.repo }}/openapi/machine-api.json | |
- name: commit the changes in the repo | |
shell: bash | |
run: | | |
cd ${{ matrix.repo }} | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -am "YOYO NEW API SPEC!" || exit 0 | |
git fetch origin | |
git rebase origin/main || exit 0 | |
export NEW_BRANCH="update-spec" | |
git checkout -b "$NEW_BRANCH" | |
git push -f origin "$NEW_BRANCH" | |
gh pr create --title "Update machine-api spec" \ | |
--body "Updating the openapi spec from that in the machine-api repo" \ | |
--head "$NEW_BRANCH" \ | |
--reviewer jessfraz \ | |
--base main || true | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |