Skip to content

Repository Data Sync #3111

Repository Data Sync

Repository Data Sync #3111

---
name: Repository Data Sync
on:
workflow_dispatch:
schedule:
- cron: '10 * * * *'
permissions:
id-token: write
contents: read
defaults:
run:
working-directory: ./tf-repo-mgmt
jobs:
repository-data:
name: Get Repository Data
runs-on: ubuntu-latest
environment: avm
steps:
- name: Checkout Bootstrap Modules
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Create GitHub App Token
id: app-token
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
with:
app-id: ${{ secrets.AVM_APP_CLIENT_ID }}
private-key: ${{ secrets.AVM_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Get Repository Data
run: |
$repositories = @(../.github/actions/avm-repos/scripts/Get-RepositoriesWhereAppInstalled.ps1 -outputDirectory "${{ github.workspace }}")
Write-Host (ConvertTo-Json $repositories -Depth 10)
# remove the terraform-azurerm-avm-template repo from the list
$repositories = $repositories.Where({ $_.repoName -ne 'terraform-azurerm-avm-template' })
./scripts/Invoke-RepositoryDataSync.ps1 -repositories $repositories -outputDirectory "${{ github.workspace }}"
shell: pwsh
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Upload Repo Data JSON
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: repositoryData.json
path: repositoryData.json
- name: Upload Repo Data CSV Files
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: CSV
path: |
*.csv
- name: Upload Repo Logs Json
if: always() && hashFiles('warning.log.json') != ''
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: warning.log.json
path: warning.log.json
- name: Repo Error
if: always() && hashFiles('warning.log.json') != ''
run: |
$issueLogJson = Get-Content -Path "${{ github.workspace }}/warning.log.json" -Raw
$issueLog = ConvertFrom-Json $issueLogJson
$issueLog | ForEach-Object {
echo "::error title=$($_.repoId) has issues::$($_.message)"
}
shell: pwsh