Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A GitHub Action to suggest removal of non-organization members from CODEOWNERS files

License

NotificationsYou must be signed in to change notification settings

github/cleanowners

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

CodeQLLint Code BasePython packageDocker Image CIOpenSSF Scorecard

Cleanowners is a GitHub Action that is designed to help keepCODEOWNERS files current by removing users that are no longer a part of the organization. This is helpful for companies that are looking to remove outdated information in theCODEOWNERS file. This action can be paired with otherCODEOWNERS related actions to suggest new owners or lintCODEOWNERS files to ensure accuracy.

This action was developed by the GitHub OSPO for our own use and developed in a way that we could open source it that it might be useful to you as well! If you want to know more about how we use it, reach out in an issue in this repository.

Support

If you need support using this project or have questions about it, pleaseopen up an issue in this repository. Requests made directly to GitHub staff or support team will be redirected here to open an issue. GitHub SLA's and support/services contracts do not apply to this repository.

OSPO GitHub Actions as a Whole

All feedback regarding our GitHub Actions, as a whole, should be communicated throughissues on our github-ospo repository.

Use as a GitHub Action

  1. Create a repository to host this GitHub Action or select an existing repository.
  2. Select a best fit workflow file from theexamples below.
  3. Copy that example into your repository (from step 1) and into the proper directory for GitHub Actions:.github/workflows/ directory with the file extension.yml (ie..github/workflows/cleanowners.yml)
  4. Edit the values (ORGANIZATION,EXEMPT_REPOS) from the sample workflow with your information.
  5. Also edit the value forGH_ENTERPRISE_URL if you are using a GitHub Server and not using github.com. For github.com users, don't put anything in here.
  6. Update the value ofGH_TOKEN. Do this by creating aGitHub API token with permissions to read the repository/organization and write issues or pull requests. Then take the value of the API token you just created, andcreate a repository secret where the name of the secret isGH_TOKEN and the value of the secret the API token. It just needs to match between when you create the secret name and when you refer to it in the workflow file.
  7. Commit the workflow file to the default branch (oftenmaster ormain)
  8. Wait for the action to trigger based on theschedule entry or manually trigger the workflow as shown in thedocumentation.

Configuration

Below are the allowed configuration options:

Authentication

This action can be configured to authenticate with GitHub App Installation or Personal Access Token (PAT). If all configuration options are provided, the GitHub App Installation configuration has precedence. You can choose one of the following methods to authenticate:

GitHub App Installation
fieldrequireddefaultdescription
GH_APP_IDTrue""GitHub Application ID. Seedocumentation for more details.
GH_APP_INSTALLATION_IDTrue""GitHub Application Installation ID. Seedocumentation for more details.
GH_APP_PRIVATE_KEYTrue""GitHub Application Private Key. Seedocumentation for more details.
GITHUB_APP_ENTERPRISE_ONLYFalsefalseSet this input totrue if your app is created in GHE and communicates with GHE.
Personal Access Token (PAT)
fieldrequireddefaultdescription
GH_TOKENTrue""The GitHub Token used to scan the repository. Must have read access to all repository you are interested in scanning.

Other Configuration Options

fieldrequireddefaultdescription
GH_ENTERPRISE_URLFalse""TheGH_ENTERPRISE_URL is used to connect to an enterprise server instance of GitHub. github.com users should not enter anything here.
ORGANIZATIONRequired to haveORGANIZATION orREPOSITORYThe name of the GitHub organization which you want this action to work from. ie. github.com/github would begithub
REPOSITORYRequired to haveORGANIZATION orREPOSITORYThe name of the repository and organization which you want this action to work from. ie.github/cleanowners or a comma separated list of multiple repositoriesgithub/cleanowners,super-linter/super-linter
EXEMPT_REPOSFalse""These repositories will be exempt from this action. ex: If my org is set togithub then I might want to exempt a few of the repos but get the rest by settingEXEMPT_REPOS togithub/cleanowners,github/contributors
DRY_RUNFalseFalseIf set to true, this action will not create any pull requests. It will only log the repositories that could have theCODEOWNERS file updated. This is useful for testing or discovering the scope of this issue in your organization.
ISSUE_REPORTFalseFalseIf set to true, this action will create an issue in the repository with the report on the repositories that had users removed from theCODEOWNERS file.

Example workflows

Basic

---name:Weekly codeowners cleanupon:workflow_dispatch:schedule:    -cron:"3 2 1 * *"permissions:contents:readjobs:cleanowners:name:cleanownersruns-on:ubuntu-latestpermissions:issues:writesteps:      -name:Run cleanowners actionuses:github/cleanowners@v1env:GH_TOKEN:${{ secrets.GH_TOKEN }}ORGANIZATION:<YOUR_ORGANIZATION_GOES_HERE>

Advanced

---name:Weekly codeowners cleanupon:workflow_dispatch:schedule:    -cron:"3 2 1 * *"permissions:contents:readjobs:cleanowners:name:cleanownersruns-on:ubuntu-latestpermissions:issues:writesteps:      -name:Run cleanowners actionuses:github/cleanowners@v1env:GH_TOKEN:${{ secrets.GH_TOKEN }}ORGANIZATION:<YOUR_ORGANIZATION_GOES_HERE>EXEMPT_REPOS:"org_name/repo_name_1, org_name/repo_name_2"ISSUE_REPORT:true      -name:Create issueuses:peter-evans/create-issue-from-file@v5with:title:Cleanowners Reportcontent-filepath:./report.mdassignees:<YOUR_GITHUB_HANDLE_HERE>token:${{ secrets.GITHUB_TOKEN }}

Authenticating with a GitHub App and Installation

You can authenticate as a GitHub App Installation by providing additional environment variables. IfGH_TOKEN is set alongside these GitHub App Installation variables, theGH_TOKEN will be ignored and not used.

---name:Weekly codeowners cleanup via GitHub Appon:workflow_dispatch:schedule:    -cron:"3 2 1 * *"permissions:contents:readjobs:cleanowners:name:cleanownersruns-on:ubuntu-latestpermissions:issues:writesteps:      -name:Run cleanowners actionuses:github/cleanowners@v1env:GH_APP_ID:${{ secrets.GH_APP_ID }}GH_APP_INSTALLATION_ID:${{ secrets.GH_APP_INSTALLATION_ID }}GH_APP_PRIVATE_KEY:${{ secrets.GH_APP_PRIVATE_KEY }}ORGANIZATION:<YOUR_ORGANIZATION_GOES_HERE>EXEMPT_REPOS:"org_name/repo_name_1, org_name/repo_name_2"

Local usage without Docker

  1. Make sure you have at least Python3.11 installed
  2. Copy.env-example to.env
  3. Fill out the.env file with atoken from a user that has access to the organization (listed below). Tokens should have at least write:org and write:repository access.
  4. Fill out the.env file with the configuration parameters you want to use
  5. pip3 install -r requirements.txt
  6. Runpython3 ./cleanowners.py, which will output everything in the terminal

License

MIT

More OSPO Tools

Looking for more resources for your open source program office (OSPO)? Check out thegithub-ospo repository for a variety of tools designed to support your needs.

About

A GitHub Action to suggest removal of non-organization members from CODEOWNERS files

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors5


[8]ページ先頭

©2009-2025 Movatter.jp