Skip to content

Commit

Permalink
DRIVERS-2956 Fix findComment in GitHub App scripts (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Aug 28, 2024
1 parent 2b21e78 commit 46a7a77
Show file tree
Hide file tree
Showing 7 changed files with 1,214 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .evergreen/github_app/create_or_modify_comment.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ const headers = {
};

// Find a matching comment.
const comment = await findComment(octokit, owner, repo, targetSha, bodyMatch, "open");
const {comment, issue_number } = await findComment(octokit, owner, repo, targetSha, bodyMatch, "open");
if (!comment) {
// create comment.
await octokit.request("POST /repos/{owner}/{repo}/issues/{issue_number}/comments", {
owner,
repo,
issue_number: issueNumber,
issue_number,
body: bodyText,
headers
});
Expand Down
8 changes: 8 additions & 0 deletions .evergreen/github_app/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import globals from "globals";
import pluginJs from "@eslint/js";


export default [
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
];
6 changes: 1 addition & 5 deletions .evergreen/github_app/get_backport_target.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Look for a cherry-pick target based on a comment in a PR.
*/
import * as fs from "fs";
import * as process from "process";
import { program } from 'commander';
import { getOctokit, findComment } from './utils.mjs';
Expand All @@ -26,12 +25,9 @@ const {

// Set up the app.
const octokit = await getOctokit(owner);
const headers = {
"x-github-api-version": "2022-11-28",
};

// Find a matching comment.
const comment = await findComment(octokit, owner, repo, targetSha, BODY_MATCH, "closed");
const { comment } = await findComment(octokit, owner, repo, targetSha, BODY_MATCH, "closed");
if (!comment) {
process.exit(0);
}
Expand Down
Loading

0 comments on commit 46a7a77

Please sign in to comment.