All Projects → mtfoley → pr-compliance-action

mtfoley / pr-compliance-action

Licence: MIT license
Check PR for compliance on title, linked issues, and files changed

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to pr-compliance-action

deployer-php-action
Deploy PHP projects using Deployer from Github Actions
Stars: ✭ 57 (-62.25%)
Mutual labels:  actions, action
assign-one-project-github-action
Automatically add an issue or pull request to specific GitHub Project(s) when you create and/or label them.
Stars: ✭ 140 (-7.28%)
Mutual labels:  actions, action
rubocop-linter-action
Rubocop Linter Action: A GitHub Action to run Rubocop against your code!
Stars: ✭ 86 (-43.05%)
Mutual labels:  actions, action
setup-jdk
(DEPRECATED) Set up your GitHub Actions workflow with a specific version of AdoptOpenJDK
Stars: ✭ 32 (-78.81%)
Mutual labels:  actions, action
action-sync-node-meta
GitHub Action that syncs package.json with the repository metadata.
Stars: ✭ 25 (-83.44%)
Mutual labels:  actions, action
setup-hashlink
A github action to install and setup Hashlink
Stars: ✭ 13 (-91.39%)
Mutual labels:  actions, action
jest-github-action
Jest action adding checks with annotations to your pull requests and coverage table as comments
Stars: ✭ 134 (-11.26%)
Mutual labels:  actions, action
redux-reducer-async
Create redux reducers for async behaviors of multiple actions.
Stars: ✭ 14 (-90.73%)
Mutual labels:  actions, action
action-autotag
Automatically generate a new tag when the manifest file (package.json, Dockerfile, custom file, etc) version changes.
Stars: ✭ 45 (-70.2%)
Mutual labels:  actions, action
gh-action-community
GitHub Action for the Community, from welcoming first timers to badges
Stars: ✭ 24 (-84.11%)
Mutual labels:  actions, action
dart-package-publisher
Action to Publish Dart / Flutter Package To https://pub.dev When you need to publish a package, just bump the version in pubspec.yaml
Stars: ✭ 45 (-70.2%)
Mutual labels:  actions, action
github-run-tests-action
mabl Github Actions implementation
Stars: ✭ 39 (-74.17%)
Mutual labels:  actions, action
chrome-extension-upload
upload & publish extensions to the Chrome Web Store.
Stars: ✭ 35 (-76.82%)
Mutual labels:  actions, action
clojure-dependency-update-action
A simple GitHub Actions job to create Pull Requests for outdated dependencies in clojure projects
Stars: ✭ 37 (-75.5%)
Mutual labels:  actions, action
actions
Set of actions for implementing CI/CD with werf and GitHub Actions
Stars: ✭ 67 (-55.63%)
Mutual labels:  actions, action
actions
Collection of repetitive GitHub Actions
Stars: ✭ 12 (-92.05%)
Mutual labels:  actions, action
action-dynamic-readme
~ Dynamic ReadME Generator ~
Stars: ✭ 29 (-80.79%)
Mutual labels:  actions, action
action-homebrew-bump-formula
⚙️ A GitHub Action to easily bump Homebrew formula on new release
Stars: ✭ 68 (-54.97%)
Mutual labels:  actions, action
ssh2actions
Connect to GitHub Actions VM via SSH for interactive debugging
Stars: ✭ 62 (-58.94%)
Mutual labels:  actions, action
k-redux-factory
Factory of Redux reducers and their associated actions and selectors.
Stars: ✭ 18 (-88.08%)
Mutual labels:  actions, action

pr-compliance-action

This action is meant to help in managing inbound PRs that may need adjustment other than code.

Functionality

It looks for the following:

  • PR Title formatted according to conventional commits.
  • PR Body refers to an issue, as detected by a regular expression
  • PR originates from a branch other than the protected branch, e.g. "main", (based on head ref)
  • PR does not include modifications to specific files that should be reviewed carefully (e.g. package.json)

Sample Workflow File

Below is a sample yaml file to place in .github/workflows/:

name: PR Compliance

on:
  pull_request_target:
    types: [opened, edited, reopened]

# Action should have write permission to make updates to PR
permissions:
  pull-requests: write

jobs:
  pr-compliance:
    runs-on: ubuntu-latest
    steps:
      - uses: mtfoley/pr-compliance-action@main
        with:
          # all inputs are optional
          watch-files: |
            package.json
            npm-shrinkwrap.json

Behavior

This action drives the following outcomes with all inputs at default:

Check Outcome on Flagging
PR Title Lint Fails Action shows as failed check. Action leaves review comment.
PR Does Not Refer to Issue Action closes issue. Action leaves review comment.
PR Originates from Protected Branch Action closes issue. Action leaves review comment.
PR Modifies Watched Files Action leaves review comment.

If 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.

Inputs

All inputs are optional and have default values.

Name Default Description
repo-token secrets.GITHUB_TOKEN Access token for which this action will run. This action uses @actions/core library.
ignore-authors dependabot
dependabot[bot]
If the action detects that the PR author is one of these logins, it will skip checks and set all outputs to true.
base-comment (see action.yml) Preamble to any comment the action leaves on the PR.
ignore-team-members true Whether to ignore in the case that the PR author is a) the owner of repository, or b) has a public membership1 in the org that owns the repository.
body-regex (fix(es|ed)?|((resolve|close)(s|d)?)) #\d*[1-9]\d* Regular expression to identify whether the PR body refers to an issue23.
body-fail false Whether to trigger a failing check when the body-regex is not matched in the PR body. Triggers a warning by default.
body-auto-close true Whether or not to auto-close on failed check of PR Body
body-comment (see action.yml) Comment to leave on PR on failed check of PR Body
protected-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.
protected-branch-auto-close true Whether or not to auto-close on failed check of PR head branch
protected-branch-comment (see action.yml) Comment to leave on PR on failed check of PR head branch.
title-check-enable true Whether or not to lint PR title per conventional commits.
title-comment (see action.yml) Comment to leave on PR on failed check of PR title per conventional commits
watch-files (Blank) Files to flag for modifications (e.g. package.json)
watch-files-comment (see action.yml) Comment to leave on PR when watched files have been changed.

Outputs

Each check performed is also manifested in an output.

Name Description
body-check Result of match for PR Body against configured regex.
branch-check Result of check to ensure PR head is not protected branch.
title-check Result of check to ensure PR title is formatted per conventional commits
watch-files-check Result of check for watched files having been modified. True if no modifications found to watched files.

Footnotes

  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.

  2. Default regular expression is based on linking 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*

  3. The body check can be configured to always pass by using a sufficiently generic regex, e.g. .*, that will match any PR description.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].