Skip to content

Commit f179bf2

Browse files
CopilotPhantomDave
andauthored
Fix dependabot approval error and add deployment guards for non-app changes (#34)
* Initial plan * Fix PR approval error and add deploy check for non-app changes Co-authored-by: PhantomDave <34485699+PhantomDave@users.noreply.github.com> * Add CodeQL configuration for security scanning Co-authored-by: PhantomDave <34485699+PhantomDave@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: PhantomDave <34485699+PhantomDave@users.noreply.github.com>
1 parent e9e1801 commit f179bf2

4 files changed

Lines changed: 103 additions & 8 deletions

File tree

.github/codeql/codeql-config.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "BankTracker CodeQL Config"
2+
3+
# Disable default queries and use security-extended query suite for comprehensive security scanning
4+
disable-default-queries: false
5+
6+
queries:
7+
- uses: security-extended
8+
- uses: security-and-quality
9+
10+
# Paths to exclude from analysis
11+
paths-ignore:
12+
- '**/node_modules/**'
13+
- '**/dist/**'
14+
- '**/build/**'
15+
- '**/bin/**'
16+
- '**/obj/**'
17+
- '**/*.Designer.cs'
18+
- '**/Migrations/**'
19+
- '**/wwwroot/lib/**'
20+
- 'frontend/src/generated/**'
21+
- '**/*.min.js'
22+
- '**/*.min.css'
23+
- '**/package-lock.json'
24+
- '**/yarn.lock'
25+
- '**/pnpm-lock.yaml'
26+
27+
# Paths to include for analysis
28+
paths:
29+
- 'PhantomDave.BankTracking.Api/**'
30+
- 'PhantomDave.BankTracking.Data/**'
31+
- 'PhantomDave.BankTracking.Library/**'
32+
- 'frontend/src/**'
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: "CodeQL Analysis"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
# Run CodeQL analysis at 2 AM UTC every day
10+
- cron: '0 2 * * *'
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
analyze:
19+
name: Analyze (${{ matrix.language }})
20+
runs-on: ubuntu-latest
21+
permissions:
22+
security-events: write
23+
packages: read
24+
actions: read
25+
contents: read
26+
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- language: csharp
32+
build-mode: manual
33+
- language: javascript-typescript
34+
build-mode: none
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v4
39+
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v3
42+
with:
43+
languages: ${{ matrix.language }}
44+
build-mode: ${{ matrix.build-mode }}
45+
config-file: ./.github/codeql/codeql-config.yml
46+
47+
- name: Setup .NET
48+
if: matrix.language == 'csharp'
49+
uses: actions/setup-dotnet@v4
50+
with:
51+
dotnet-version: '9.0.x'
52+
53+
- name: Restore dependencies
54+
if: matrix.language == 'csharp'
55+
run: dotnet restore PhantomDave.BankTracking.sln
56+
57+
- name: Build .NET solution
58+
if: matrix.language == 'csharp'
59+
run: dotnet build PhantomDave.BankTracking.sln --configuration Release --no-restore
60+
61+
- name: Perform CodeQL Analysis
62+
uses: github/codeql-action/analyze@v3
63+
with:
64+
category: "/language:${{ matrix.language }}"

.github/workflows/dependabot-auto-merge.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Dependabot Auto-Approve and Auto-Merge
1+
name: Dependabot Auto-Merge
22

33
on:
44
pull_request_target:
@@ -10,7 +10,7 @@ permissions:
1010

1111
jobs:
1212
dependabot:
13-
name: Auto-approve and enable auto-merge
13+
name: Enable auto-merge for Dependabot
1414
runs-on: ubuntu-latest
1515
# Only run for Dependabot PRs
1616
if: github.actor == 'dependabot[bot]'
@@ -21,12 +21,6 @@ jobs:
2121
with:
2222
github-token: "${{ secrets.GITHUB_TOKEN }}"
2323

24-
- name: Approve PR
25-
run: gh pr review --approve "$PR_URL"
26-
env:
27-
PR_URL: ${{ github.event.pull_request.html_url }}
28-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29-
3024
- name: Enable auto-merge for Dependabot PRs
3125
run: gh pr merge --auto --squash "$PR_URL"
3226
env:

.github/workflows/deploy-tailscale.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
outputs:
2020
backend: ${{ steps.filter.outputs.backend }}
2121
frontend: ${{ steps.filter.outputs.frontend }}
22+
has_app_changes: ${{ steps.filter.outputs.backend == 'true' || steps.filter.outputs.frontend == 'true' || steps.filter.outputs.compose == 'true' }}
2223
steps:
2324
- name: Checkout
2425
uses: actions/checkout@v4
@@ -37,6 +38,9 @@ jobs:
3738
frontend:
3839
- 'frontend/**'
3940
- '.github/workflows/build-frontend-image.yml'
41+
compose:
42+
- 'compose.yaml'
43+
- 'compose.local.yaml'
4044
4145
wait-for-backend:
4246
name: Wait for Backend Image
@@ -77,6 +81,7 @@ jobs:
7781
if: |
7882
always() && !cancelled() &&
7983
!contains(needs.*.result, 'failure') &&
84+
(needs.detect-changes.outputs.has_app_changes == 'true') &&
8085
(needs.wait-for-backend.result == 'success' || needs.wait-for-backend.result == 'skipped') &&
8186
(needs.wait-for-frontend.result == 'success' || needs.wait-for-frontend.result == 'skipped')
8287
permissions:

0 commit comments

Comments
 (0)