Skip to content

Commit 3583353

Browse files
committed
ci(tools): prevents actions from running when unrelated changes are made
1 parent 88e1a60 commit 3583353

4 files changed

Lines changed: 99 additions & 18 deletions

File tree

.github/workflows/generate-client.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,30 @@ on:
55
types:
66
- opened
77
- synchronize
8+
paths-ignore:
9+
- 'release-notes.md'
10+
- development.md
11+
- deployment.md
12+
- SECURITY.md
13+
- README.md
14+
- LICENSE
15+
- .pre-commit-config.yaml
16+
- .gitignore
17+
- .gitattributes
18+
- img/*
19+
- hooks/*
20+
- .copier/*
821

922
jobs:
1023
generate-client:
1124
permissions:
1225
contents: write
1326
runs-on: ubuntu-latest
1427
steps:
15-
# For PRs from forks
1628
- uses: actions/checkout@v4
17-
# For PRs from the same repo
18-
- uses: actions/checkout@v4
19-
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
2029
with:
2130
ref: ${{ github.head_ref }}
22-
token: ${{ secrets.FULL_STACK_FASTAPI_TEMPLATE_REPO_TOKEN }}
31+
token: ${{ github.token }}
2332
- uses: actions/setup-node@v4
2433
with:
2534
node-version: lts/*
@@ -39,19 +48,10 @@ jobs:
3948
- run: uv run bash scripts/generate-client.sh
4049
env:
4150
VIRTUAL_ENV: backend/.venv
42-
- name: Add changes to git
51+
- name: Commit changes
4352
run: |
4453
git config --local user.email "github-actions@github.com"
4554
git config --local user.name "github-actions"
4655
git add frontend/src/client
47-
# Same repo PRs
48-
- name: Push changes
49-
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
50-
run: |
5156
git diff --staged --quiet || git commit -m "✨ Autogenerate frontend client"
5257
git push
53-
# Fork PRs
54-
- name: Check changes
55-
if: ( github.event_name == 'pull_request' && github.secret_source != 'Actions' )
56-
run: |
57-
git diff --staged --quiet || (echo "Changes detected in generated client, run scripts/generate-client.sh and commit the changes" && exit 1)

.github/workflows/lint-backend.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,40 @@ name: Lint Backend
33
on:
44
push:
55
branches:
6-
- master
6+
- main
7+
paths-ignore:
8+
- 'release-notes.md'
9+
- renovate.json
10+
- development.md
11+
- deployment.md
12+
- SECURITY.md
13+
- README.md
14+
- LICENSE
15+
- .pre-commit-config.yaml
16+
- .gitignore
17+
- .gitattributes
18+
- .editorconfig
19+
- '.better-commits.json'
20+
- img/*
21+
- hooks/*
22+
- .copier/*
723
pull_request:
824
types:
925
- opened
1026
- synchronize
27+
paths-ignore:
28+
- 'release-notes.md'
29+
- development.md
30+
- deployment.md
31+
- SECURITY.md
32+
- README.md
33+
- LICENSE
34+
- .pre-commit-config.yaml
35+
- .gitignore
36+
- .gitattributes
37+
- img/*
38+
- hooks/*
39+
- .copier/*
1140

1241
jobs:
1342
lint-backend:

.github/workflows/playwright.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,37 @@ name: Playwright Tests
33
on:
44
push:
55
branches:
6-
- master
6+
- main
7+
paths-ignore:
8+
- 'release-notes.md'
9+
- development.md
10+
- deployment.md
11+
- SECURITY.md
12+
- README.md
13+
- LICENSE
14+
- .pre-commit-config.yaml
15+
- .gitignore
16+
- .gitattributes
17+
- img/*
18+
- hooks/*
19+
- .copier/*
720
pull_request:
821
types:
922
- opened
1023
- synchronize
24+
paths-ignore:
25+
- 'release-notes.md'
26+
- development.md
27+
- deployment.md
28+
- SECURITY.md
29+
- README.md
30+
- LICENSE
31+
- .pre-commit-config.yaml
32+
- .gitignore
33+
- .gitattributes
34+
- img/*
35+
- hooks/*
36+
- .copier/*
1137
workflow_dispatch:
1238
inputs:
1339
debug_enabled:

.github/workflows/test-backend.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,37 @@ name: Test Backend
33
on:
44
push:
55
branches:
6-
- master
6+
- main
7+
paths-ignore:
8+
- 'release-notes.md'
9+
- development.md
10+
- deployment.md
11+
- SECURITY.md
12+
- README.md
13+
- LICENSE
14+
- .pre-commit-config.yaml
15+
- .gitignore
16+
- .gitattributes
17+
- img/*
18+
- hooks/*
19+
- .copier/*
720
pull_request:
821
types:
922
- opened
1023
- synchronize
24+
paths-ignore:
25+
- 'release-notes.md'
26+
- development.md
27+
- deployment.md
28+
- SECURITY.md
29+
- README.md
30+
- LICENSE
31+
- .pre-commit-config.yaml
32+
- .gitignore
33+
- .gitattributes
34+
- img/*
35+
- hooks/*
36+
- .copier/*
1137

1238
jobs:
1339
test-backend:

0 commit comments

Comments
 (0)