fetch-repository-stats #396
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: fetch-repository-stats | |
concurrency: fetch-repository-stats | |
on: | |
schedule: | |
- cron: "0 23 * * *" | |
workflow_dispatch: | |
jobs: | |
# Find all the cicsdev repositories to generate reports for | |
define-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
repos: ${{ steps.repos.outputs.repos }} | |
steps: | |
- name: Define Repositories | |
id: repos | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
set -eux | |
REPOS=$(gh api \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"/orgs/cicsdev/repos?type=public&per_page=100&sort=updated&direction=desc" | \ | |
jq -c '[.[] | select(.archived==false) | .full_name]') | |
echo "repos=$REPOS" >> "$GITHUB_OUTPUT" | |
run-ghrs-with-matrix: | |
name: github-repo-stats | |
runs-on: ubuntu-latest | |
needs: define-matrix | |
strategy: | |
matrix: | |
statsRepo: ${{ fromJSON(needs.define-matrix.outputs.repos) }} | |
# Do not cancel&fail all remaining jobs upon first job failure. | |
fail-fast: false | |
# Help avoid commit conflicts. Note(JP): this should not be | |
# necessary anymore, feedback appreciated | |
max-parallel: 1 | |
steps: | |
- name: run-ghrs | |
uses: jgehrcke/github-repo-stats@306db38ad131cab2aa5f2cd3062bf6f8aa78c1aa | |
# Exclude non-sample repos | |
if: ${{ !contains(fromJSON('["cicsdev/.github", "cicsdev/repo-stats", "cicsdev/cicsdev.github.io"]'), matrix.statsRepo) }} | |
with: | |
repository: ${{ matrix.statsRepo }} | |
databranch: reports | |
ghtoken: ${{ secrets.ghrs_github_api_token }} |