Skip to content

Commit

Permalink
Add ownerNoPings option to prevent GitHub pings
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperupcall committed Feb 16, 2024
1 parent dad98b0 commit f66648c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ packages/documentation/copy/es/**/*.ts @KingDarBoja [translate] [es]

## Config

There are five options available at the moment:
There are six options available at the moment:

- `cwd`, which can be used to determine the root folder to look for CODEOWNER files in.
- `merge_method`, which can be `merge` (default), `squash` or `rebase`, depending on what you want the action to do.
- `quiet` - does not output a message saying who can merge PRs
- `ownerNoPings` - list of usernames to wrap mention in an inline code block to prevent pinging

```yml
- name: Run Codeowners merge check
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ inputs:
default: ''
required: false

ownerNoPings:
description: 'Wrap mention in inline code block to prevent pings'
default: '[]'
required: false

runs:
using: 'node12'
main: 'index.js'
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async function commentOnMergablePRs() {
process.exit(0)
}




// Determine who has access to merge every file in this PR
Expand Down Expand Up @@ -94,7 +94,11 @@ async function commentOnMergablePRs() {
process.exit(0)
}

const owners = new Intl.ListFormat().format(ownersWhoHaveAccessToAllFilesInPR);
const ownerNoPings = JSON.parse(core.getInput('ownerNoPings'))
const formattedOwnersWhoHaveAccessToAllFilesInPR = ownersWhoHaveAccessToAllFilesInPR.map((owner) => {
return ownerNoPings.includes(owner) ? `\`${owner}\`` : owner
})
const owners = new Intl.ListFormat().format(formattedOwnersWhoHaveAccessToAllFilesInPR);
const message = `Thanks for the PR!
This section of the codebase is owned by ${owners} - if they write a comment saying "LGTM" then it will be merged.
Expand Down

0 comments on commit f66648c

Please sign in to comment.