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

strip out test plan comment #9

Merged
merged 8 commits into from
Nov 29, 2023
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backport",
"version": "2.0.7",
"version": "2.0.8",
"license": "MIT",
"main": "dist/index.js",
"files": [
Expand Down
3 changes: 2 additions & 1 deletion src/backport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
} from "@octokit/webhooks-types";
import ensureError from "ensure-error";
import { compact } from "lodash-es";
import { stripTestPlanFromPRBody } from "./utils.js";

const getBaseBranchFromLabel = (
label: string,
Expand Down Expand Up @@ -301,7 +302,7 @@ const backport = async ({
for (const base of baseBranches) {
const body = getBody({
base,
body: originalBody ?? "",
body: originalBody ? stripTestPlanFromPRBody(originalBody) : "",
mergeCommitSha,
number,
});
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ const run = async () => {
}

const payload = context.payload as PullRequestEvent;
const runId = context.runId;
const runId = context.runId;
const serverUrl = context.serverUrl;

if (payload.action !== "closed" && payload.action !== "labeled") {
throw new Error(
`Unsupported pull request event action: ${payload.action}.`,
);
}

const createdPullRequestBaseBranchToNumber = await backport({
getBody,
getHead,
Expand Down
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const stripTestPlanFromPRBody = (body: string): string =>
body.replace(/<!--[\s\S]*?-->/g, "");