Skip to content

ci-repo-watcher

ci-repo-watcher #208

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: ./comment-or-create
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`