Skip to content

Commit a06134c

Browse files
mawasilemattdot
andauthored
chore: update dependencies and improve workflow configurations (#299)
* chore: update dependencies and improve workflow configurations - Bump azd version to 1.20.0 in devcontainer.json - Update checkout and setup actions in azure-dev.yml - Add Node.js setup step in terraform-validate.yml - Adjust target framework indentation in Directory.Build.props and CopilotTests.csproj * chore(deps): upgrade actions/setup-node to v6.0.0 in workflows * chore: simplify checkout step in Azure workflow * chore: rename "Azd down" step to "Destroy Infrastructure" for clarity * chore: add concurrency configuration to prevent simultaneous deployments * chore: enhance AZURE_ENV_NAME logic for pull requests * Update .github/workflows/azure-dev.yml Co-authored-by: Matt Dotson <[email protected]> * Apply suggestion from @mattdot Co-authored-by: Matt Dotson <[email protected]> * chore: add comment for id-token permission in workflows --------- Co-authored-by: Matt Dotson <[email protected]>
1 parent a5cc734 commit a06134c

File tree

6 files changed

+50
-22
lines changed

6 files changed

+50
-22
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": "9.0"
1717
},
1818
"ghcr.io/azure/azure-dev/azd:latest": {
19-
"version": "1.18.1"
19+
"version": "1.20.0"
2020
},
2121
"./features/dev-tools": {}
2222
},
@@ -38,8 +38,9 @@
3838
"bierner.markdown-mermaid",
3939
"ms-dotnettools.csharp",
4040
"ms-dotnettools.vscode-dotnet-runtime"
41-
// Include other VSCode extensions if needed
42-
// Right click on an extension inside VSCode to add directly to devcontainer.json, or copy the extension ID
41+
42+
// Include other VSCode extensions if needed. Right click on an extension inside VSCode
43+
// to add directly to devcontainer.json, or copy the extension ID
4344
],
4445
"settings": {
4546
"terraform.languageServer.enable":true,

.github/workflows/azure-dev-down.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
default: "eastus"
1515

1616
permissions:
17-
id-token: write
17+
id-token: write # Needed for OIDC Authentication
1818
contents: read
1919

2020
jobs:
@@ -36,7 +36,7 @@ jobs:
3636
version: '1.20.0' # Specify your desired azd version here
3737

3838
- name: Setup Node.js
39-
uses: actions/setup-node@v5
39+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
4040
with:
4141
node-version: '18.x'
4242

.github/workflows/azure-dev.yml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,44 @@ on:
2020
# Set this to the mainline branch you are using
2121
branches:
2222
- main
23+
pull_request:
24+
# Run when pull requests are opened or updated
25+
branches:
26+
- main
27+
2328
# GitHub Actions workflow to deploy to Azure using azd
29+
# Ensure only one deployment runs at a time to prevent conflicts
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
32+
cancel-in-progress: false
2433

2534
permissions:
2635
actions: read # Needed for uploading SARIF reports
2736
security-events: write # Needed for uploading SARIF reports
28-
id-token: write
37+
id-token: write # Needed for OIDC Authentication
2938
contents: read
3039

3140

3241
jobs:
3342
build:
3443
runs-on: ${{ fromJson(vars.ACTIONS_RUNNER_NAME || '["ubuntu-latest"]') }}
3544
env:
36-
AZURE_ENV_NAME: ${{ github.event.inputs.azd_environment_name || 'CICD' }}
45+
AZURE_ENV_NAME: ${{ github.event.inputs.azd_environment_name || (github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number)) || 'CICD' }}
3746
AZURE_LOCATION: ${{ github.event.inputs.azure_location || 'eastus' }}
3847

3948
steps:
40-
- name: Checkout the branch ${{ github.ref_name }}
41-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
49+
- name: Checkout code
50+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4251
with:
43-
ref: ${{ github.ref_name }}
52+
persist-credentials: false
4453

4554
- name: Install azd
46-
uses: Azure/setup-azd@cf638ffd167fc81e1851241a478a723c05fa9cb3 # v2.2.0
55+
uses: Azure/setup-azd@cf638ffd167fc81e1851241a478a723c05fa9cb3 # v2.2.0
4756
with:
4857
version: '1.20.0' # Specify your desired azd version here
4958

5059
- name: Setup Node.js
51-
uses: actions/setup-node@v5
60+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
5261
with:
5362
node-version: '18.x'
5463

@@ -58,7 +67,7 @@ jobs:
5867
terraform_version: 1.13.3
5968

6069
- name: Install TFLint
61-
uses: terraform-linters/setup-tflint@acd1575d3c037258ce5b2dd01379dc49ce24c6b7 # v6.2.0
70+
uses: terraform-linters/setup-tflint@acd1575d3c037258ce5b2dd01379dc49ce24c6b7 # v6.2.0
6271
with:
6372
tflint_version: v0.58.1
6473
github_token: ${{ secrets.GITHUB_TOKEN }} # Used to avoid rate
@@ -86,9 +95,21 @@ jobs:
8695
echo "GitLeaks scan completed"
8796
8897
- name: Setup .NET SDK
89-
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
90-
with:
91-
dotnet-version: '8.0.x'
98+
shell: bash
99+
run: |
100+
# Install .NET SDK to temp directory for self-hosted runners to avoid permission issues
101+
DOTNET_INSTALL_DIR="${{ runner.temp }}/dotnet"
102+
mkdir -p "$DOTNET_INSTALL_DIR"
103+
104+
# Download and run the dotnet-install script
105+
curl -sSL https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh
106+
chmod +x dotnet-install.sh
107+
./dotnet-install.sh --channel 9.0 --install-dir "$DOTNET_INSTALL_DIR"
108+
rm dotnet-install.sh
109+
110+
# Add to PATH for subsequent steps
111+
echo "$DOTNET_INSTALL_DIR" >> $GITHUB_PATH
112+
echo "DOTNET_ROOT=$DOTNET_INSTALL_DIR" >> $GITHUB_ENV
92113
93114
- name: Install Power Platform Tools
94115
uses: microsoft/powerplatform-actions/actions-install@6c7b538671a040d11afd8ab94d77bfe3b3ed87e6 # v1.9.1
@@ -100,7 +121,7 @@ jobs:
100121
pac help
101122
102123
- name: Set Up Python
103-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # 6.0.0
124+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # 6.0.0
104125
with:
105126
python-version: "3.x"
106127

@@ -180,8 +201,8 @@ jobs:
180201
with:
181202
sarif_file: ./checkov-results.sarif/results_sarif.sarif
182203

183-
- name: Azd down
184-
if: ${{ github.event.inputs.run_azd_down == 'true' }}
204+
- name: Destroy Infrastructure
205+
if: ${{ github.event.inputs.run_azd_down == 'true' || github.event_name == 'pull_request' }}
185206
env:
186207
POWER_PLATFORM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
187208
POWER_PLATFORM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}

.github/workflows/terraform-validate.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ permissions:
1313
contents: read
1414
security-events: write
1515
pull-requests: write # Allow workflow to comment on PRs
16+
id-token: write # Needed for OIDC Authentication
1617

1718
# Global environment variables
1819
env:
@@ -49,10 +50,15 @@ jobs:
4950
with:
5051
fetch-depth: 0 # Required for proper GitLeaks scanning
5152

53+
- name: Setup Node.js
54+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
55+
with:
56+
node-version: '18.x'
57+
5258
- name: Setup Terraform
5359
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
5460
with:
55-
terraform_version: "1.12.2" # Pinning specific version
61+
terraform_version: "1.13.3" # Pinning specific version
5662

5763
- name: Terraform Init
5864
id: tf-init

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<LangVersion>latest</LangVersion>

tests/Copilot/CopilotTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<IsPackable>false</IsPackable>

0 commit comments

Comments
 (0)