Skip to content

Update registry

Update registry #1923

name: Update registry
on:
schedule:
- cron: "0 9 * * *" # at 9:00
push:
branches:
- master
paths:
- ".github/workflows/update-registry.yml"
- ".github/scripts/**"
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v4
- uses: ./.github/actions/install-yaml
- name: Update registry entries
uses: Amadevus/pwsh-script@v2
id: update
with:
script: |
$ErrorActionPreference = 'Stop'
$args = @{
RegistryPath = Resolve-Path ./registry
Token = $github.token
}
./.github/scripts/Update-Registry.ps1 @args -Verbose
- name: Format PR text
uses: Amadevus/pwsh-script@v2
id: formatting
env:
UPDATE_JSON: ${{ steps.update.outputs.result }}
with:
script: |
$repos = $env:UPDATE_JSON | ConvertFrom-Json
$adds = $repos.add | Where-Object { $_ } | ForEach-Object { "- add $($_.html_url)`n" }
$dels = $repos.del | Where-Object { $_ } | ForEach-Object { "- rem $($_.html_url) *($($_.reason))*`n" }
@{
count = $repos.count
pr_body_repo_list = -join @($adds + $dels)
}
- name: Create PR with registry updates
uses: peter-evans/create-pull-request@v6
with:
commit-message: ":robot: Update ${{ fromJSON(steps.formatting.outputs.result).count }} registry entries"
branch: bot/registry-update
delete-branch: true
title: "🤖 Update registry entries"
body: |
Updated repositories:
${{ fromJSON(steps.formatting.outputs.result).pr_body_repo_list }}
[Workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})