{"id":13626480,"url":"https://github.com/mtfoley/pr-compliance-action","last_synced_at":"2025-04-07T16:19:24.193Z","repository":{"id":37948776,"uuid":"411003249","full_name":"mtfoley/pr-compliance-action","owner":"mtfoley","description":"Check PR for compliance on title, linked issues, and files changed","archived":false,"fork":false,"pushed_at":"2023-12-01T22:01:24.000Z","size":6595,"stargazers_count":159,"open_issues_count":19,"forks_count":15,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T14:12:35.135Z","etag":null,"topics":["action","actions","github","github-actions"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtfoley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-09-27T18:42:17.000Z","updated_at":"2024-10-05T20:01:44.000Z","dependencies_parsed_at":"2024-01-14T07:17:42.021Z","dependency_job_id":"cd973eab-c34b-4d08-bde3-8a2f9973e7da","html_url":"https://github.com/mtfoley/pr-compliance-action","commit_stats":{"total_commits":198,"total_committers":5,"mean_commits":39.6,"dds":"0.41414141414141414","last_synced_commit":"a9c0416f42aa97fd11fe3c2bbd55e01c56e72639"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":"actions/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtfoley%2Fpr-compliance-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtfoley%2Fpr-compliance-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtfoley%2Fpr-compliance-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtfoley%2Fpr-compliance-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtfoley","download_url":"https://codeload.github.com/mtfoley/pr-compliance-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685634,"owners_count":20979085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action","actions","github","github-actions"],"created_at":"2024-08-01T21:02:20.158Z","updated_at":"2025-04-07T16:19:24.174Z","avatar_url":"https://github.com/mtfoley.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# pr-compliance-action\n\nThis action is meant to help in managing inbound PRs that may need adjustment other than code.\n\n## Functionality\n\nIt looks for the following:\n- [x] PR Title formatted according to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).\n- [x] PR Body refers to an issue, as detected by a regular expression\n- [x] PR originates from a branch other than the protected branch, e.g. \"main\", (based on head ref)\n- [x] PR does not include modifications to specific files that should be reviewed carefully (e.g. package.json)\n\n## Sample Workflow File\n\nBelow is a sample yaml file to place in `.github/workflows/`:\n\n```yml\nname: PR Compliance\n\non:\n  pull_request_target:\n    types: [opened, edited, reopened]\n\n# Action should have write permission to make updates to PR\npermissions:\n  pull-requests: write\n  # Uncomment the line below if using the `issue-labels`\n  # option on a private repository.\n\n  # issues: read\n\njobs:\n  pr-compliance:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: mtfoley/pr-compliance-action@main\n        with:\n          # all inputs are optional\n          watch-files: |\n            package.json\n            npm-shrinkwrap.json\n          issue-labels: |\n            accepting prs\n```\n\n## Behavior\n\nThis action drives the following outcomes with all inputs at default:\n\nCheck | Outcome on Flagging\n--- | ---\nPR Title Lint Fails | Action shows as failed check. Action leaves review comment.\nPR Does Not Refer to Issue | Action closes issue. Action leaves review comment.\nPR Originates from Protected Branch | Action closes issue. Action leaves review comment.\nPR Modifies Watched Files | Action leaves review comment.\n\nIf a PR is initially deemed non-compliant by the action and a review comment is left, the action will update this same review comment each time it runs again (e.g. if the PR title or description changes). If the PR is found to be compliant after changes, the review comment will be updated to reflect this.\n\n## Inputs\n\nAll inputs are optional and have default values.\n\nName | Default | Description\n--- | --- | ---\nrepo-token | `secrets.GITHUB_TOKEN` | Access token for which this action will run. This action uses `@actions/core` library.\nignore-authors | dependabot\u003cbr/\u003edependabot[bot] | If the action detects that the PR author is one of these logins, it will skip checks and set all outputs to `true`.\nbase-comment | (see [action.yml](./action.yml)) | Preamble to any comment the action leaves on the PR.\nignore-team-members | true | Whether to ignore in the case that the PR author is a) the owner of repository, or b) has a public membership[^1] in the org that owns the repository.\nbody-regex | (see [action.yml](./action.yml)) | Regular expression to identify whether the PR body refers to an issue[^2][^3].\nbody-fail | false | Whether to trigger a failing check when the body-regex is not matched in the PR body. Triggers a warning by default.\nbody-auto-close | true | Whether or not to auto-close on failed check of PR Body\nbody-comment | (see [action.yml](./action.yml)) | Comment to leave on PR on failed check of PR Body\nissue-labels | (Blank) | List of labels that must exist on all issues linked to a PR[^4].\nissue-labels-auto-close | true | Whether to auto-close on failed check of issue labels.\nissue-labels-comment | (see [action.yml](./action.yml)) | Comment to leave on PR when issue labels are missing.\nprotected-branch | (Blank) | Branch that check should ensure that PR does not use as it's head. If left blank, it falls back to default branch.\nprotected-branch-auto-close | true | Whether or not to auto-close on failed check of PR head branch\nprotected-branch-comment | (see [action.yml](./action.yml)) | Comment to leave on PR on failed check of PR head branch.\ntitle-check-enable | true | Whether or not to lint PR title per [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).\ntitle-comment | (see [action.yml](./action.yml)) | Comment to leave on PR on failed check of PR title per [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)\nwatch-files | (Blank) | Files to flag for modifications (e.g. package.json)\nwatch-files-comment | (see [action.yml](./action.yml)) | Comment to leave on PR when watched files have been changed.\n\n[^1]: In a case where a contributor has a private membership to the org, the `ignore-authors` may be used to skip checks - however, this workflow file configuration could effectively make membership public.\n[^2]: Default regular expression is based on [linking to an issue using a keyword](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword). To keep PRs related to issues within the same same repo, we use the `KEYWORD #ISSUE-NUMBER` syntax. However, one could also use a regular expression like `(fix(es|ed)?|((resolve|close)(s|d)?)) (my-org)\\/([a-z0-9\\-_]*)#\\d*[1-9]\\d*`\n[^3]: The body check can be configured to always pass by using a sufficiently generic regex, e.g. `.*`, that will  match any PR description.\n[^4]: The issue labels check needs read permissions for issues to see what labels are on the linked issues for the PR. For public repositories, the workflow file should not need any adjustment. For private repositories, the workflow file will need to have the `issues: read` permission added if any issue labels are specified as required.\n\n## Outputs\n\nEach check performed is also manifested in an output.\n\nName | Description\n--- | ---\nbody-check | Result of match for PR Body against configured regex.\nbranch-check | Result of check to ensure PR head is not protected branch.\ntitle-check | Result of check to ensure PR title is formatted per [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)\nwatch-files-check | Result of check for watched files having been modified. True if no modifications found to watched files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtfoley%2Fpr-compliance-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtfoley%2Fpr-compliance-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtfoley%2Fpr-compliance-action/lists"}