-
Notifications
You must be signed in to change notification settings - Fork 20
59 lines (53 loc) · 1.85 KB
/
update-registry.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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@v5
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 }})