DSACMS / repo-scaffolder

Templates and commandline tools for creating repositories for US Federal open source projects
Creative Commons Zero v1.0 Universal
21 stars 8 forks source link

Automatically Generate a Contributors List in MAINTAINERS.md file #102

Closed Firebird1029 closed 2 months ago

Firebird1029 commented 2 months ago

Automatically Generate a Contributors List in MAINTAINERS.md file

Problem

The goal is to display a list of contributors that contributed to a repo and the total count of contributors.

Solution

This PR contains a GitHub Actions workflow script that generates a contributors list in MAINTAINERS.md file based on the contributors within a GitHub repository and commits it back to the repository. It also includes a count of contributors too.

Result

Note that this PR will not add a Github Action workflow to repo-scaffolder itself. It only adds the workflow to the Tier 2-4 templates inside repo-scaffolder.

Example: See here

IsaacMilarky commented 2 months ago

Looks good but I'm confused as to why the outbound checklist changes were added to this PR

Firebird1029 commented 2 months ago

Oh I merged in the dev branch, which added in other unrelated commits to this PR

Firebird1029 commented 2 months ago

Note for future people: the line QUERY='query { repository(owner: \"'"$OWNER"'\", name: \"'"$REPO"'\") { collaborators { totalCount } } }' in the Github Action workflow script cannot have newlines or else the Github API complains it is invalid JSON :(

For a longer query, you could try circumvent weird Bash interpolation issues by creating a separate .gql file and loading it into the curl request...?