Skip to content

Commit

Permalink
Add PR merged comment on pull request closure
Browse files Browse the repository at this point in the history
  • Loading branch information
VaibhavSys committed Jan 8, 2024
1 parent 3200dc2 commit a44fa19
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const utils = require("./utils.js");
const WAIT_TIME_AFTER_EACH_FILE = 30000; // 30 seconds
const IGNORE_LABELS = ["maintainer"];
const IGNORE_TITLES = ["no-rm", "rm-skip"];
const PR_MERGED_CONTENT_LINK = "https://raw.githubusercontent.com/is-a-dev/team-docs/main/pr-merged.md"

/**
* This is the main entrypoint to your Probot app
Expand All @@ -16,6 +17,22 @@ module.exports = (app) => {
throw new Error("Missing Environment Variable: IMGBB_KEY");

app.log.info("The app was loaded!");
app.on([
"pull_request.closed",
],
async (context) => {
if (context.payload.pull_request.merged !== true) {
return;
}
const { owner, repo, pull_number } = context.pullRequest();
const pr_merged_message = await utils.getRawFileContent(PR_MERGED_CONTENT_LINK);
await context.octokit.issues.createComment({
owner,
repo,
issue_number: pull_number,
body: pr_merged_message,
});
})
app.on(
[
"pull_request.opened",
Expand Down

0 comments on commit a44fa19

Please sign in to comment.