Skip to content

Commit e21886e

Browse files
Enhance Azure template validation workflow by copying necessary files to content-gen directory
1 parent d40e5d1 commit e21886e

2 files changed

Lines changed: 29 additions & 12 deletions

File tree

.github/workflows/azure-dev.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,49 @@ on:
55
branches:
66
- main
77
- psl-bug-36267
8-
8+
99
permissions:
1010
contents: read
1111
id-token: write
1212
pull-requests: write
13-
13+
1414
jobs:
1515
template_validation_job:
1616
runs-on: ubuntu-latest
1717
environment: production
1818
name: Template validation
19-
19+
2020
steps:
2121
# Step 1: Checkout the code from your repository
2222
- name: Checkout code
2323
uses: actions/checkout@v4
24-
25-
# Step 2: Validate the Azure template using microsoft/template-validation-action
24+
25+
# Step 2: Copy root-level files required by template validation into working directory
26+
- name: Copy root files to content-gen
27+
run: |
28+
for file in README.md LICENSE SECURITY.md CODE_OF_CONDUCT.md CONTRIBUTING.md; do
29+
if [ -f "$file" ] && [ ! -f "content-gen/$file" ]; then
30+
cp "$file" "content-gen/$file"
31+
fi
32+
done
33+
34+
# Copy ISSUE_TEMPLATE folder into content-gen/.github/
35+
if [ -d ".github/ISSUE_TEMPLATE" ] && [ ! -d "content-gen/.github/ISSUE_TEMPLATE" ]; then
36+
mkdir -p content-gen/.github/ISSUE_TEMPLATE
37+
cp -r .github/ISSUE_TEMPLATE/* content-gen/.github/ISSUE_TEMPLATE/
38+
fi
39+
40+
# Copy azure-dev.yml workflow into content-gen/.github/workflows/
41+
if [ -f ".github/workflows/azure-dev.yml" ] && [ ! -f "content-gen/.github/workflows/azure-dev.yml" ]; then
42+
mkdir -p content-gen/.github/workflows
43+
cp .github/workflows/azure-dev.yml content-gen/.github/workflows/azure-dev.yml
44+
fi
45+
46+
# Step 3: Validate the Azure template using microsoft/template-validation-action
2647
- name: Validate Azure Template
2748
uses: microsoft/template-validation-action@v0.4.3
2849
with:
50+
workingDirectory: ./content-gen
2951
validateAzd: ${{ vars.TEMPLATE_VALIDATE_AZD }}
3052
useDevContainer: ${{ vars.TEMPLATE_USE_DEV_CONTAINER }}
3153
validateTests: ${{ vars.TEMPLATE_VALIDATE_TESTS }}
@@ -37,7 +59,7 @@ jobs:
3759
AZURE_ENV_NAME: ${{ secrets.AZURE_ENV_NAME }}
3860
AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }}
3961
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
41-
# Step 3: Print the result of the validation
62+
63+
# Step 4: Print the result of the validation
4264
- name: Print result
4365
run: cat ${{ steps.validation.outputs.resultFile }}

.templateignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)