Repository Sync #324
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Repository Sync | |
on: | |
workflow_dispatch: | |
inputs: | |
repositories: | |
description: 'Override the target repositories, use a comma separated list. Leave as All to run on all repositories.' | |
default: 'All' | |
type: string | |
first_run: | |
description: 'Whether to run in first run mode' | |
default: false | |
type: boolean | |
plan_only: | |
description: 'Whether to only plan the changes' | |
default: true | |
type: boolean | |
schedule: | |
- cron: '0 0,4,8,12,16,20 * * *' | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
run-sync: | |
name: Run Sync | |
runs-on: ubuntu-latest | |
environment: avm-updates | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Download CSV Files | |
run: | | |
./scripts/Invoke-AvmRepoCsvDownload.ps1 | |
shell: pwsh | |
- name: Sync Repositories | |
run: | | |
$triggerType = "${{ github.event_name }}" | |
$repositories = "All" | |
$firstRun = $false | |
$planOnly = $false | |
if($triggerType -eq "workflow_dispatch") { | |
$repositories = "${{ inputs.repositories }}" | |
$firstRun = "${{ inputs.first_run }}".ToLower() -eq "true" | |
$planOnly = "${{ inputs.plan_only }}".ToLower() -eq "true" | |
} | |
Write-Output "Repositories: $repositories" | |
Write-Output "First Run: $firstRun" | |
Write-Output "Plan Only: $planOnly" | |
if($repositories -eq "All") { | |
$repositories = @() | |
} else { | |
$repositories = $repositories -split ',' | |
} | |
gh auth login -h "GitHub.com" | |
./scripts/Invoke-RepoSync.ps1 -repoFilter $repositories -firstRun $firstRun -planOnly $planOnly | |
shell: pwsh | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | |
ARM_USE_AZUREAD: true | |
ARM_USE_OIDC: true | |
- name: Upload Issue Logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: issue.log | |
path: issue.log | |
- name: Upload Issue Logs Json | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: issue.log.json | |
path: issue.log.json |