Skip to content

Commit

Permalink
oss-governance-bot to always ignore dependabot pr open event (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingloh authored Sep 30, 2021
1 parent 4d2536b commit 99f1d48
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
19 changes: 16 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion src/rules/ignore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ function ignoreLabeledRaceCondition(): boolean {
return false
}

function isDependabot(): boolean {
const payload = github.context.payload
return payload.sender?.login === 'dependabot[bot]'
}

/**
* Ignore non 'User' to prevent infinite loop.
*/
Expand All @@ -55,7 +60,7 @@ function ignoreBot(): boolean {
core.info(
`ignore: ignore bot - type:${payload.sender?.type} - login:${payload.sender?.login}`
)
if (payload.sender?.login === 'dependabot[bot]') {
if (isDependabot()) {
return false
}
return payload.sender?.type !== 'User'
Expand Down Expand Up @@ -99,6 +104,15 @@ export default async function (): Promise<boolean> {
return true
}

if (isDependabot()) {
if (is('pull_request', ['opened'])) {
return true
}
if (is('pull_request_target', ['opened'])) {
return true
}
}

if (ignoreLabeledRaceCondition()) {
core.info('ignore: labeled race condition')
return true
Expand Down

0 comments on commit 99f1d48

Please sign in to comment.