Skip to content

Commit ed2e9bb

Browse files
Add GitHub workflows for Dependabot, build and test, code quality, and PR verification
1 parent 751bae2 commit ed2e9bb

File tree

6 files changed

+190
-0
lines changed

6 files changed

+190
-0
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
assignees: ["frasermolyneux"]
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- "feature/**"
7+
- "bugfix/**"
8+
- "hotfix/**"
9+
10+
permissions: {}
11+
12+
jobs:
13+
bicep-validation:
14+
permissions:
15+
contents: read
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Azure CLI
23+
uses: azure/login@v2
24+
with:
25+
creds: ${{ secrets.AZURE_CREDENTIALS }}
26+
27+
- name: Validate Bicep modules
28+
shell: bash
29+
run: |
30+
echo "Validating Bicep modules..."
31+
for bicep_file in $(find modules -name "main.bicep"); do
32+
echo "Validating $bicep_file"
33+
az bicep build --file "$bicep_file"
34+
done

.github/workflows/codequality.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Code Quality
2+
3+
on:
4+
schedule:
5+
- cron: "0 3 * * 1" # Monday 3am UTC
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
types: [opened, synchronize, reopened, ready_for_review]
13+
14+
permissions: {}
15+
16+
jobs:
17+
sonar-scanning:
18+
permissions:
19+
contents: read
20+
pull-requests: read
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: SonarCloud Scan
30+
uses: SonarSource/sonarcloud-github-action@master
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
34+
with:
35+
args: >
36+
-Dsonar.projectKey=frasermolyneux_bicep-modules
37+
-Dsonar.organization=frasermolyneux
38+
-Dsonar.host.url=https://sonarcloud.io
39+
40+
devops-secure-scanning:
41+
permissions:
42+
contents: read
43+
actions: read
44+
id-token: write
45+
security-events: write
46+
uses: frasermolyneux/actions/.github/workflows/devops-secure-scanning.yml@main
47+
48+
dependency-review:
49+
permissions:
50+
contents: read
51+
pull-requests: write
52+
if: github.event_name == 'pull_request'
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v6
57+
- name: Dependency Review
58+
uses: actions/dependency-review-action@v4
59+
with:
60+
comment-summary-in-pr: always
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Copilot Setup Steps"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
permissions: {}
13+
14+
jobs:
15+
copilot-setup-steps:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v6
23+
24+
- name: Checkout additional repo
25+
uses: actions/checkout@v6
26+
with:
27+
repository: frasermolyneux/.github-copilot
28+
path: .github-copilot
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Dependabot Auto-Merge
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
permissions: {}
8+
9+
jobs:
10+
dependabot:
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
runs-on: ubuntu-latest
15+
16+
if: ${{ github.actor == 'dependabot[bot]' }}
17+
steps:
18+
- name: Dependabot metadata
19+
id: metadata
20+
uses: dependabot/fetch-metadata@v2
21+
with:
22+
github-token: "${{ secrets.GITHUB_TOKEN }}"
23+
- name: Enable auto-merge for Dependabot PRs
24+
run: gh pr merge --auto --squash "$PR_URL"
25+
env:
26+
PR_URL: ${{github.event.pull_request.html_url}}
27+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/pr-verify.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: PR Verify
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
8+
9+
permissions: {}
10+
11+
jobs:
12+
bicep-validation:
13+
permissions:
14+
contents: read
15+
if: github.event.pull_request.draft == false
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Azure CLI
23+
uses: azure/login@v2
24+
with:
25+
creds: ${{ secrets.AZURE_CREDENTIALS }}
26+
27+
- name: Validate Bicep modules
28+
shell: bash
29+
run: |
30+
echo "Validating Bicep modules..."
31+
for bicep_file in $(find modules -name "main.bicep"); do
32+
echo "Validating $bicep_file"
33+
az bicep build --file "$bicep_file"
34+
done

0 commit comments

Comments
 (0)