File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,10 +25,14 @@ jobs:
2525 contents : write
2626 runs-on : ubuntu-latest
2727 steps :
28+ # For PRs from forks
2829 - uses : actions/checkout@v4
30+ # For PRs from the same repo
31+ - uses : actions/checkout@v4
32+ if : ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
2933 with :
3034 ref : ${{ github.head_ref }}
31- token : ${{ github.token }}
35+ token : ${{ secrets.FULL_STACK_FASTAPI_TEMPLATE_REPO_TOKEN }}
3236 - uses : actions/setup-node@v4
3337 with :
3438 node-version : lts/*
@@ -48,10 +52,19 @@ jobs:
4852 - run : uv run bash scripts/generate-client.sh
4953 env :
5054 VIRTUAL_ENV : backend/.venv
51- - name : Commit changes
55+ - name : Add changes to git
5256 run : |
5357 git config --local user.email "github-actions@github.com"
5458 git config --local user.name "github-actions"
5559 git add frontend/src/client
60+ # Same repo PRs
61+ - name : Push changes
62+ if : ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
63+ run : |
5664 git diff --staged --quiet || git commit -m "✨ Autogenerate frontend client"
5765 git push
66+ # Fork PRs
67+ - name : Check changes
68+ if : ( github.event_name == 'pull_request' && github.secret_source != 'Actions' )
69+ run : |
70+ git diff --staged --quiet || (echo "Changes detected in generated client, run scripts/generate-client.sh and commit the changes" && exit 1)
You can’t perform that action at this time.
0 commit comments