From 3583353c7ea04f3d239b4a3ccf75c5cf88d3808e Mon Sep 17 00:00:00 2001 From: Justin-p Date: Thu, 3 Oct 2024 10:13:34 +0200 Subject: [PATCH 1/5] ci(tools): prevents actions from running when unrelated changes are made --- .github/workflows/generate-client.yml | 30 +++++++++++++------------- .github/workflows/lint-backend.yml | 31 ++++++++++++++++++++++++++- .github/workflows/playwright.yml | 28 +++++++++++++++++++++++- .github/workflows/test-backend.yml | 28 +++++++++++++++++++++++- 4 files changed, 99 insertions(+), 18 deletions(-) diff --git a/.github/workflows/generate-client.yml b/.github/workflows/generate-client.yml index 1cf417ab89..80af6f73b9 100644 --- a/.github/workflows/generate-client.yml +++ b/.github/workflows/generate-client.yml @@ -5,6 +5,19 @@ on: types: - opened - synchronize + paths-ignore: + - 'release-notes.md' + - development.md + - deployment.md + - SECURITY.md + - README.md + - LICENSE + - .pre-commit-config.yaml + - .gitignore + - .gitattributes + - img/* + - hooks/* + - .copier/* jobs: generate-client: @@ -12,14 +25,10 @@ jobs: contents: write runs-on: ubuntu-latest steps: - # For PRs from forks - uses: actions/checkout@v4 - # For PRs from the same repo - - uses: actions/checkout@v4 - if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) with: ref: ${{ github.head_ref }} - token: ${{ secrets.FULL_STACK_FASTAPI_TEMPLATE_REPO_TOKEN }} + token: ${{ github.token }} - uses: actions/setup-node@v4 with: node-version: lts/* @@ -39,19 +48,10 @@ jobs: - run: uv run bash scripts/generate-client.sh env: VIRTUAL_ENV: backend/.venv - - name: Add changes to git + - name: Commit changes run: | git config --local user.email "github-actions@github.com" git config --local user.name "github-actions" git add frontend/src/client - # Same repo PRs - - name: Push changes - if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) - run: | git diff --staged --quiet || git commit -m "✨ Autogenerate frontend client" git push - # Fork PRs - - name: Check changes - if: ( github.event_name == 'pull_request' && github.secret_source != 'Actions' ) - run: | - git diff --staged --quiet || (echo "Changes detected in generated client, run scripts/generate-client.sh and commit the changes" && exit 1) diff --git a/.github/workflows/lint-backend.yml b/.github/workflows/lint-backend.yml index c7d7f2f8e4..01695881a8 100644 --- a/.github/workflows/lint-backend.yml +++ b/.github/workflows/lint-backend.yml @@ -3,11 +3,40 @@ name: Lint Backend on: push: branches: - - master + - main + paths-ignore: + - 'release-notes.md' + - renovate.json + - development.md + - deployment.md + - SECURITY.md + - README.md + - LICENSE + - .pre-commit-config.yaml + - .gitignore + - .gitattributes + - .editorconfig + - '.better-commits.json' + - img/* + - hooks/* + - .copier/* pull_request: types: - opened - synchronize + paths-ignore: + - 'release-notes.md' + - development.md + - deployment.md + - SECURITY.md + - README.md + - LICENSE + - .pre-commit-config.yaml + - .gitignore + - .gitattributes + - img/* + - hooks/* + - .copier/* jobs: lint-backend: diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index a884800227..381002d3c4 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -3,11 +3,37 @@ name: Playwright Tests on: push: branches: - - master + - main + paths-ignore: + - 'release-notes.md' + - development.md + - deployment.md + - SECURITY.md + - README.md + - LICENSE + - .pre-commit-config.yaml + - .gitignore + - .gitattributes + - img/* + - hooks/* + - .copier/* pull_request: types: - opened - synchronize + paths-ignore: + - 'release-notes.md' + - development.md + - deployment.md + - SECURITY.md + - README.md + - LICENSE + - .pre-commit-config.yaml + - .gitignore + - .gitattributes + - img/* + - hooks/* + - .copier/* workflow_dispatch: inputs: debug_enabled: diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 2244836a01..876f99fb98 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -3,11 +3,37 @@ name: Test Backend on: push: branches: - - master + - main + paths-ignore: + - 'release-notes.md' + - development.md + - deployment.md + - SECURITY.md + - README.md + - LICENSE + - .pre-commit-config.yaml + - .gitignore + - .gitattributes + - img/* + - hooks/* + - .copier/* pull_request: types: - opened - synchronize + paths-ignore: + - 'release-notes.md' + - development.md + - deployment.md + - SECURITY.md + - README.md + - LICENSE + - .pre-commit-config.yaml + - .gitignore + - .gitattributes + - img/* + - hooks/* + - .copier/* jobs: test-backend: From 7fb7126d2fa8a443fb24615e48de67f579475e4b Mon Sep 17 00:00:00 2001 From: Justin Perdok Date: Sat, 5 Oct 2024 00:25:40 +0200 Subject: [PATCH 2/5] undo accidental changes --- .github/workflows/generate-client.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-client.yml b/.github/workflows/generate-client.yml index 80af6f73b9..1f38516aa9 100644 --- a/.github/workflows/generate-client.yml +++ b/.github/workflows/generate-client.yml @@ -25,10 +25,14 @@ jobs: contents: write runs-on: ubuntu-latest steps: + # For PRs from forks - uses: actions/checkout@v4 + # For PRs from the same repo + - uses: actions/checkout@v4 + if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) with: ref: ${{ github.head_ref }} - token: ${{ github.token }} + token: ${{ secrets.FULL_STACK_FASTAPI_TEMPLATE_REPO_TOKEN }} - uses: actions/setup-node@v4 with: node-version: lts/* @@ -48,10 +52,19 @@ jobs: - run: uv run bash scripts/generate-client.sh env: VIRTUAL_ENV: backend/.venv - - name: Commit changes + - name: Add changes to git run: | git config --local user.email "github-actions@github.com" git config --local user.name "github-actions" git add frontend/src/client + # Same repo PRs + - name: Push changes + if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) + run: | git diff --staged --quiet || git commit -m "✨ Autogenerate frontend client" git push + # Fork PRs + - name: Check changes + if: ( github.event_name == 'pull_request' && github.secret_source != 'Actions' ) + run: | + git diff --staged --quiet || (echo "Changes detected in generated client, run scripts/generate-client.sh and commit the changes" && exit 1) From 71fc2d9f0846e970d4437f8a023937e9f1cf24c8 Mon Sep 17 00:00:00 2001 From: Justin Perdok Date: Sat, 5 Oct 2024 00:26:10 +0200 Subject: [PATCH 3/5] undo accidental changes --- .github/workflows/lint-backend.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-backend.yml b/.github/workflows/lint-backend.yml index 01695881a8..bcfa1211b0 100644 --- a/.github/workflows/lint-backend.yml +++ b/.github/workflows/lint-backend.yml @@ -3,7 +3,7 @@ name: Lint Backend on: push: branches: - - main + - master paths-ignore: - 'release-notes.md' - renovate.json From 542959c2ec2f4a776824032b98e928ec13e16b11 Mon Sep 17 00:00:00 2001 From: Justin Perdok Date: Sat, 5 Oct 2024 00:26:32 +0200 Subject: [PATCH 4/5] undo accidental changes --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 381002d3c4..334261a03a 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -3,7 +3,7 @@ name: Playwright Tests on: push: branches: - - main + - master paths-ignore: - 'release-notes.md' - development.md From 0ffedaf9ace90b05c6ec301ea0a39d4800e6a8b0 Mon Sep 17 00:00:00 2001 From: Justin Perdok Date: Sat, 5 Oct 2024 00:27:06 +0200 Subject: [PATCH 5/5] undo accidental changes --- .github/workflows/test-backend.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 876f99fb98..a20889ef53 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -3,7 +3,7 @@ name: Test Backend on: push: branches: - - main + - master paths-ignore: - 'release-notes.md' - development.md