forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflows: notify on manual autobump
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const fs = require('fs') | ||
const path = require('path'); | ||
|
||
module.exports = async ({github, context, core}, autobump_list) => { | ||
// Parse event | ||
const json = fs.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: "utf-8" }) | ||
const event = JSON.parse(json) | ||
const pull = event.pull_request | ||
|
||
// Fetch PR files | ||
const files = await github.rest.pulls.listFiles({ | ||
...context.repo, | ||
pull_number: pull.number | ||
}) | ||
|
||
const autobump_array = autobump_list.split(" ") | ||
|
||
for (const file of files.data) { | ||
if(autobump_array.includes(path.parse(file.filename).name)) { | ||
github.rest.issues.createComment({ | ||
...context.repo, | ||
issue_number: pull.number, | ||
body: ` | ||
Hi! You have used \`brew bump-formula-pr\` on a formula that is on the autobump list. | ||
No need to manually bump it, BrewTestBot will automatically create an equivalent pull reques for you! | ||
We prefer that you spend time fixing broken pull requests instead of manually bumping formulae.` | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters