Skip to content

Commit 0efb85e

Browse files
Fix update samples workflow
1 parent 8948400 commit 0efb85e

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

.github/workflows/update-samples.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ on:
66
workflow_dispatch:
77

88
jobs:
9-
main:
9+
update-samples:
1010
name: Update Samples
11+
permissions:
12+
contents: write
1113
runs-on: ubuntu-latest
1214

1315
env:
@@ -19,21 +21,26 @@ jobs:
1921
with:
2022
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
2123

24+
- name: Setup .NET Core
25+
uses: actions/setup-dotnet@v4
26+
27+
- name: Clone quickstarts
28+
uses: actions/checkout@v4
29+
with:
30+
repository: Azure/azure-quickstart-templates
31+
path: workflow-temp/azure-quickstart-templates
32+
2233
- name: Update Samples
2334
shell: pwsh
24-
run: ./scripts/UpdateSamples.ps1
35+
run: ./scripts/UpdateSamples.ps1 -QuickStartsRepoPath workflow-temp/azure-quickstart-templates
2536

2637
- name: Update Baselines
2738
run: ./scripts/update_baselines.sh
28-
29-
- name: Create Pull Request
30-
uses: peter-evans/create-pull-request@v7
39+
# this will fail if there are changes - this is expected
40+
continue-on-error: true
41+
42+
- name: Commit and push
43+
uses: stefanzweifel/git-auto-commit-action@v5
3144
with:
32-
committer: GitHub <[email protected]>
33-
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
34-
signoff: false
35-
branch: update-samples
36-
delete-branch: true
37-
title: |
38-
Update Quickstart & AVM Sample Links
39-
draft: false
45+
commit_message: Update Quickstart & AVM samples
46+
file_pattern: settings/samples src/TemplateRefGenerator.Tests/Files

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,6 @@ FodyWeavers.xsd
396396

397397
# JetBrains Rider
398398
*.sln.iml
399+
400+
# Temporary directory for GitHub workflows to use
401+
/workflow-temp

scripts/UpdateSamples.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ function GetQuickstartLinks {
2929
$metadataPaths = Get-ChildItem $QuickStartsRepoPath -File -Recurse -Include "metadata.json" | Sort-Object FullName
3030
foreach ($metadataPath in $metadataPaths) {
3131
Write-Host "Processing $metadataPath"
32-
$templatePath = Join-Path $metadataPath.DirectoryName "azuredeploy.json" -Resolve
32+
$templatePath = Join-Path $metadataPath.DirectoryName "azuredeploy.json"
33+
if (-not (Test-Path $templatePath -PathType Leaf)) {
34+
Write-Host "No template found for $metadataPath"
35+
continue
36+
}
37+
3338
$bicepPath = Join-Path $metadataPath.DirectoryName "main.bicep"
3439
$hasBicep = (Test-Path $bicepPath -PathType Leaf)
3540

0 commit comments

Comments
 (0)