-
Notifications
You must be signed in to change notification settings - Fork 648
Automate refreshing manifests with GitHub Action #9503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
eacbff5
d33e1b5
bcd5d9d
4c5941d
332f9a7
271c395
4c2123f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Refresh Manifests | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 16 * * *' # 8am PST (16:00 UTC) - same schedule as API review | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
generate-and-pr: | ||
runs-on: windows-latest # Using Windows because the script uses PowerShell and build.cmd | ||
if: ${{ github.repository_owner == 'dotnet' }} | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Setup .NET SDK | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
global-json-file: global.json | ||
|
||
- name: Run RefreshManifests Script | ||
shell: pwsh | ||
run: | | ||
./eng/refreshManifests.ps1 | ||
|
||
- name: Create or update pull request | ||
uses: dotnet/actions-create-pull-request@e8d799aa1f8b17f324f9513832811b0a62f1e0b1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: update-manifests | ||
base: main | ||
labels: | | ||
area-app-model | ||
area-engineering-systems | ||
title: "[Automated] Update Manifests" | ||
body: "Auto-generated update to refresh the manifests. This PR will be updated automatically if new changes are detected." |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,2 +1,47 @@ | ||||||
..\build.cmd | ||||||
get-childitem ..\playground\*AppHost.csproj -Recurse | % { "Generating Manifest for: $_"; dotnet run --no-build --project $_.FullName --launch-profile generate-manifest } | ||||||
#!/usr/bin/env pwsh | ||||||
|
||||||
# Get the script directory | ||||||
$scriptDir = $PSScriptRoot | ||||||
$repoRoot = Split-Path -Parent $scriptDir | ||||||
|
||||||
# Determine which build script to use based on OS | ||||||
if ($IsWindows -or $env:OS -eq "Windows_NT") { | ||||||
& "$repoRoot/build.cmd" | ||||||
} else { | ||||||
& "$repoRoot/build.sh" | ||||||
} | ||||||
|
||||||
# Find all AppHost projects in the playground directory | ||||||
$playgroundDir = Join-Path -Path $repoRoot -ChildPath "playground" | ||||||
|
||||||
if (Test-Path $playgroundDir) { | ||||||
Get-ChildItem -Path $playgroundDir -Filter "*AppHost.csproj" -Recurse | ForEach-Object { | ||||||
# Check if the project has a launchSettings.json file with a generate-manifest profile | ||||||
$projectDir = Split-Path -Parent $_.FullName | ||||||
$launchSettingsPath = Join-Path -Path $projectDir -ChildPath "Properties" -AdditionalChildPath "launchSettings.json" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Join-Path cmdlet does not support an '-AdditionalChildPath' parameter. Consider using nested Join-Path calls or joining 'Properties/launchSettings.json' as a single string to avoid runtime errors.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot can you run the script to see if it works?
|
||||||
$hasManifestProfile = $false | ||||||
|
||||||
if (Test-Path $launchSettingsPath) { | ||||||
try { | ||||||
$launchSettings = Get-Content -Raw -Path $launchSettingsPath | ConvertFrom-Json | ||||||
if ($launchSettings.profiles -and $launchSettings.profiles.'generate-manifest') { | ||||||
$hasManifestProfile = $true | ||||||
} | ||||||
} | ||||||
catch { | ||||||
Write-Warning "Failed to read or parse launch settings for $_" | ||||||
} | ||||||
} | ||||||
|
||||||
if ($hasManifestProfile) { | ||||||
Write-Host "Generating Manifest for: $_" | ||||||
dotnet run --no-build --project $_.FullName --launch-profile generate-manifest | ||||||
} | ||||||
else { | ||||||
Write-Warning "Skipping $_ - no generate-manifest profile found" | ||||||
} | ||||||
} | ||||||
} | ||||||
else { | ||||||
Write-Error "Playground directory not found at: $playgroundDir" | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
@description('The location for the resource(s) to be deployed.') | ||
param location string = resourceGroup().location | ||
|
||
param storage2_outputs_name string | ||
|
||
param principalType string | ||
|
||
param principalId string | ||
|
||
resource storage2 'Microsoft.Storage/storageAccounts@2024-01-01' existing = { | ||
name: storage2_outputs_name | ||
} | ||
|
||
resource storage2_StorageBlobDataContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
name: guid(storage2.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')) | ||
properties: { | ||
principalId: principalId | ||
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe') | ||
principalType: principalType | ||
} | ||
scope: storage2 | ||
} | ||
|
||
resource storage2_StorageTableDataContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
name: guid(storage2.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')) | ||
properties: { | ||
principalId: principalId | ||
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3') | ||
principalType: principalType | ||
} | ||
scope: storage2 | ||
} | ||
|
||
resource storage2_StorageQueueDataContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
name: guid(storage2.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88')) | ||
properties: { | ||
principalId: principalId | ||
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88') | ||
principalType: principalType | ||
} | ||
scope: storage2 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@description('The location for the resource(s) to be deployed.') | ||
param location string = resourceGroup().location | ||
|
||
resource storage2 'Microsoft.Storage/storageAccounts@2024-01-01' = { | ||
name: take('storage2${uniqueString(resourceGroup().id)}', 24) | ||
kind: 'StorageV2' | ||
location: location | ||
sku: { | ||
name: 'Standard_GRS' | ||
} | ||
properties: { | ||
accessTier: 'Hot' | ||
allowSharedKeyAccess: false | ||
minimumTlsVersion: 'TLS1_2' | ||
networkAcls: { | ||
defaultAction: 'Allow' | ||
} | ||
} | ||
tags: { | ||
'aspire-resource-name': 'storage2' | ||
} | ||
} | ||
|
||
resource blobs 'Microsoft.Storage/storageAccounts/blobServices@2024-01-01' = { | ||
name: 'default' | ||
parent: storage2 | ||
} | ||
|
||
resource foocontainer 'Microsoft.Storage/storageAccounts/blobServices/containers@2024-01-01' = { | ||
name: 'foo-container' | ||
parent: blobs | ||
} | ||
|
||
output blobEndpoint string = storage2.properties.primaryEndpoints.blob | ||
|
||
output queueEndpoint string = storage2.properties.primaryEndpoints.queue | ||
|
||
output tableEndpoint string = storage2.properties.primaryEndpoints.table | ||
|
||
output name string = storage2.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better if the manifest was updated on the PRs that made them change. Not in a separate batched PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does that look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like a test (or GH action) that runs on PRs and fails when they are out of date.