-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (46 loc) · 1.72 KB
/
ci-repo-watcher.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
name: ci-repo-watcher
on:
schedule:
- cron: "0 0 * * Mon" # once a week https://crontab.guru/#0_0_*_*
workflow_dispatch:
workflow_call:
secrets:
token:
required: true
jobs:
watcher:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
- name: Setup gh-repo-manifest
run: |
if [ ! -f bin/gh-repo-manifest ]
then
mkdir -p bin
wget https://raw.githubusercontent.com/metanorma/ci/main/bin/gh-repo-manifest -O bin/gh-repo-manifest
fi
- name: Check for new repos
id: cimas-diff
run: |
ruby bin/gh-repo-manifest -o ${{ github.repository_owner }} -m cimas-config/cimas.yml > cimas-diff.yml
cat cimas-diff.yml
yq --version
cat cimas-diff.yml | yq e '.repositories.*.remote' - | sed -e 's|^ssh://git@|- https://|' > new-repos.yml
NEW_REPOSITORIES=$(cat new-repos.yml)
echo "New repositories:"
echo "$NEW_REPOSITORIES"
echo "NEW_REPOSITORIES<<EOF"$'\n'"${NEW_REPOSITORIES}"$'\n'EOF >> $GITHUB_OUTPUT
- name: Create or update issue
if: ${{ steps.cimas-diff.outputs.NEW_REPOSITORIES != 'null' }}
uses: metanorma/ci/comment-or-create@main
with:
token: ${{ secrets.GITHUB_TOKEN || secrets.token }}
title: New repos in ${{ github.repository_owner }} found
assignees: CAMOBAP
comment: |
Review new discovered repositories during run ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}:
${{ steps.cimas-diff.outputs.NEW_REPOSITORIES }}
And add them to `cimas-config/cimas.yml` with the right set of `files`