From 90a00b066c37a75f027080771fe36d2a6cd39af6 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 6 Dec 2024 17:01:05 +0000 Subject: [PATCH] Update github-repo-stats.yml workflows Get list of repositories to process using the GitHub CLI instead of a hard coded list Also updates the databranch, and adds a dev container and maintainers file Signed-off-by: James Taylor --- .devcontainer/devcontainer.json | 25 +++++++ .github/workflows/github-repo-stats.yml | 86 ++++++------------------- MAINTAINERS.md | 5 ++ README.md | 17 +---- 4 files changed, 50 insertions(+), 83 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 MAINTAINERS.md diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..e1c8c724b6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +{ + "name": "Ubuntu", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {} + } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/workflows/github-repo-stats.yml b/.github/workflows/github-repo-stats.yml index f002cf7e1c..a05dec6626 100644 --- a/.github/workflows/github-repo-stats.yml +++ b/.github/workflows/github-repo-stats.yml @@ -7,78 +7,27 @@ on: 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: | + gh search repos --owner=cicsdev --visibility=public --archived=false --limit=99 --json=name --jq=[.[].name] >> "$GITHUB_OUTPUT" + run-ghrs-with-matrix: name: github-repo-stats runs-on: ubuntu-latest strategy: matrix: - # The repositories to generate reports for. - statsRepo: - - "cicsdev/cicstg-jca-liberty-sample" - - "cicsdev/cicstg-client-blocker" - - "cicsdev/cicstg-cloud-monitor" - - "cicsdev/cics-java-liberty-jaxrs" - - "cicsdev/cics-java-liberty-jaxws" - - "cicsdev/cics-java-osgi-mq-jms" - - "cicsdev/cics-java-liberty-appstate" - - "cicsdev/cics-java-recgen" - - "cicsdev/cics-java-liberty-globalhandler" - - "cicsdev/cics-java-j2cprog" - - "cicsdev/cics-async-api-fetch-child-example" - - "cicsdev/cics-async-api-credit-card-application-example" - - "cicsdev/cics-cpsm-wlm-trace" - - "cicsdev/cics-explorer-access-level-policing" - - "cicsdev/cics-java-liberty-restapp" - - "cicsdev/cics-async-api-channel-usage-example" - - "cicsdev/cics-bundle-scripts" - - "cicsdev/cics-java-batch" - - "cicsdev/cics-java-liberty-link" - - "cicsdev/cics-java-jcics-samples" - - "cicsdev/cics-event-consumer" - - "cicsdev/cics-ipic-heartbeat-disabler" - - "cicsdev/cics-async-fetch-variation-example" - - "cicsdev/cics-java-liberty-restapp-ext" - - "cicsdev/cics-java-liberty-tai-jwt" - - "cicsdev/cics-java-liberty-mq-jms" - - "cicsdev/cics-exci-64bit-connector" - - "cicsdev/cics-nodejs-exci-module" - - "cicsdev/cics-nodejs-exci-webapp-sample" - - "cicsdev/zospt-scripts" - - "cicsdev/cics-java-liberty-jdbc" - - "cicsdev/cics-java-liberty-sqlj" - - "cicsdev/cics-java-liberty-ejb" - - "cicsdev/cics-async-api-redbooks" - - "cicsdev/cics-java-liberty-employee-db" - - "cicsdev/cics-kerberos-sample" - - "cicsdev/cpsm-cicsplex-name-detector" - - "cicsdev/cics-java-osgi-ds" - - "cicsdev/cics-java-liberty-jaspic-jwt" - - "cicsdev/cics-java-liberty-loans-and-scoring" - - "cicsdev/cics-nodejs-invoke" - - "cicsdev/cics-java-liberty-app-deployment" - - "cicsdev/cics-policy-samples" - - "cicsdev/cics-java-jcicsx-samples" - - "cicsdev/cics-java-liberty-springboot-jcics" - - "cicsdev/cics-java-liberty-springboot-security" - - "cicsdev/blog-cics-java-mq-jms-osgi" - - "cicsdev/blog-cics-java-osgi-classloading" - - "cicsdev/blog-cics-java-batch" - - "cicsdev/blog-cics-java-jta-jdbc" - - "cicsdev/blog-cics-java-liberty-ejb" - - "cicsdev/blog-cics-java-osgi-best-practices" - - "cicsdev/cics-java-liberty-springboot-transactions" - - "cicsdev/cics-blog-sample-files" - - "cicsdev/cics-java-liberty-springboot-link" - - "cicsdev/cics-java-liberty-springboot-jdbc-multi" - - "cicsdev/cics-java-liberty-springboot-jdbc" - - "cicsdev/cics-java-liberty-springboot-jpa" - - "cicsdev/cics-java-liberty-springboot-asynchronous" - - "cicsdev/cics-genapp" - - "cicsdev/cics-java-liberty-springboot-jms" - - "cicsdev/cics-eventprocessing-java" - - "cicsdev/base64" - - "cicsdev/cics-banking-sample-application-cbsa" - - "cicsdev/cics-security-sdv-samples" + 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 @@ -87,6 +36,9 @@ jobs: steps: - name: run-ghrs uses: jgehrcke/github-repo-stats@306db38ad131cab2aa5f2cd3062bf6f8aa78c1aa + # Exclude non-sample repos + if: ${{ !contains(fromJSON('[".github", "repo-stats", "cicsdev.github.io"]'), matrix.statsRepo) }} with: repository: ${{ matrix.statsRepo }} + databranch: reports ghtoken: ${{ secrets.ghrs_github_api_token }} diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000000..9aaa047794 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,5 @@ +# Maintainers + +- James Taylor [@jt-nti](https://github.com/jt-nti) + +*Last reviewed:* December 2024 diff --git a/README.md b/README.md index 30d4889676..023e84d784 100644 --- a/README.md +++ b/README.md @@ -10,20 +10,5 @@ The `cicsdev-summary.sh` script can be used to create summary files for *clones* 1. copy `cicsdev-summary.sh` to a suitable directory on your path, e.g. `~/bin` 2. clone the `repo-stats` repository -3. check out the `github-repo-stats` branch +3. check out the `reports` branch 4. run `cicsdev-summary.sh` from the root of the `repo-stats` repository - -## TODO - -Get the list of repos automatically instead of hard coding it in the workflow - -For now, the following command will fetch a list of public repos for pasting in - -``` -curl -L \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "https://api.github.com/orgs/cicsdev/repos?per_page=100&type=public" | \ -yq '[.[].full_name | select(. != "cicsdev/cicsdev.github.io")]' -```