Skip to content

ci: dynamic repository matrix generation for contributor metrics - #2269

Open
Rucha0901 wants to merge 1 commit into
flatcar:mainfrom
Rucha0901:feat/dynamic-repo-matrix
Open

ci: dynamic repository matrix generation for contributor metrics#2269
Rucha0901 wants to merge 1 commit into
flatcar:mainfrom
Rucha0901:feat/dynamic-repo-matrix

Conversation

@Rucha0901

Copy link
Copy Markdown

Pull Request: Dynamic Repository Matrix Generation for Contributor Metrics CI

Summary of Changes

  • Dynamic Repository Discovery Script (.github/scripts/fetch_active_repos.py):

    • Implemented Python script querying GitHub REST API (/orgs/flatcar/repos) with pagination to dynamically list all active, non-archived, and non-fork repositories.
    • Added robust fallback mechanism parsing MAINTAINERS.md if API calls fail or return no results.
    • Exports discovery results to $GITHUB_ENV (REPOSITORIES=flatcar/repo1,flatcar/repo2,...).
  • Unit Tests (.github/scripts/test_fetch_active_repos.py):

    • Created unit tests covering API pagination, filter logic (excluding archived & forks), fallback parsing of MAINTAINERS.md, and $GITHUB_ENV export.
  • Workflow Enhancements (.github/workflows/issue-pr-contrib-metrics.yaml):

    • Added Fetch active repositories pre-step using .github/scripts/fetch_active_repos.py.
    • Replaced hardcoded repository string at line 55 with ${{ env.REPOSITORIES }}.
    • Fixed ShellCheck SC2129 warning by grouping summary_report.md and comment_report.md redirections into block redirects.
  • CI & Verification (.github/workflows/contrib-metrics-test.yml):

    • Added GitHub Actions workflow incorporating actionlint to automatically check syntax and lint errors across all workflow files.
    • Included Python unit test discovery for .github/scripts/.

Verification Evidence

  • Executed python3 -m unittest discover -s .github/scripts -v (4/4 tests passed).
  • Executed actionlint .github/workflows/*.yaml .github/workflows/*.yml (0 syntax errors / warnings).
  • Executed python3 .github/scripts/fetch_active_repos.py against live GitHub API (discovered 53 active repositories).

Signed-off-by: Rucha0901 imt_2025071@iiitm.ac.in

- Add python script .github/scripts/fetch_active_repos.py to fetch active non-archived repos via GitHub REST API with fallback to MAINTAINERS.md.
- Add unit test suite .github/scripts/test_fetch_active_repos.py.
- Update .github/workflows/issue-pr-contrib-metrics.yaml to fetch repos dynamically and fix SC2129 shellcheck warning.
- Add actionlint and script unit test CI workflow .github/workflows/contrib-metrics-test.yml.

Signed-off-by: Rucha0901 <imt_2025071@iiitm.ac.in>
@sayanchowdhury

Copy link
Copy Markdown
Member

Hi @Rucha0901, thanks for opening this PR!

A couple of questions before we dig into review - it's pretty challenging to read through the description.

  1. Did you use any AI tools to help write this contribution?

  2. What is your motivation for the fix or what issue are you trying to resolve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants