Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ownerNoPings option to prevent GitHub pings #43

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading