Skip to content

PR automation

PR automation #4

# This workflow finds all PRs in all repos and adds them to the
# project if they have the right label
name: Scheduled PR automation
on:
# schedule:
# # * is a special character in YAML so you have to quote this string
# - cron: '30 5,17 * * *'
workflow_dispatch:
jobs:
get_repos:
name: Get all repositories
runs-on: ubuntu-latest
outputs:
repos: ${{ steps.get_repo.outputs.repositories }}
steps:
- name: Get current repositories
id: get_repo
env:
GH_TOKEN: ${{ secrets.LAB_PAT }}
MAX_REPO: 50
run: |
repo_list=$(gh repo list $GITHUB_REPOSITORY_OWNER --no-archived -L ${MAX_REPO} --json owner,name --jq '.[] | "\(.owner.login)/\(.name)"' | jq -cnR '[inputs | select(length>0)]')
echo "repositories=${repo_list}" >> $GITHUB_OUTPUT
spawn_repo_jobs:
uses: neurobagel/planning/.github/workflows/rw_process_repo_pr.yml@main
name: ${{ matrix.repo }} scheduled PR processing
needs: get_repos
secrets: inherit
strategy:
matrix:
repo: ${{fromJSON(needs.get_repos.outputs.repos)}}
with:
repo: ${{ matrix.repo }}