Skip to content

Commit

Permalink
Link to github action
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv committed Jul 19, 2022
1 parent 386ccf8 commit ad29ac1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
10 changes: 7 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10601,7 +10601,10 @@ function getCommentBody({ options, pullNumber, backportResponse, }) {
}
const packageVersionSection = `\n<!--- Backport version: ${packageVersion_1.PACKAGE_VERSION} -->`;
const manualBackportCommand = `\n### Manual backport\nTo create the backport manually run:\n\`\`\`\n${options.backportBinary} --pr ${pullNumber}\n\`\`\`\n`;
const questionsAndLinkToBackport = '\n### Questions ?\nPlease refer to the [Backport tool documentation](https://github.com/sqren/backport)\n';
const linkToGithubActionLogs = options.githubActionRunId
? ` and see the [Github Action logs](https://github.com/${repoOwner}/${repoName}/actions/runs/${options.githubActionRunId}) for details`
: '';
const questionsAndLinkToBackport = `\n### Questions ?\nPlease refer to the [Backport tool documentation](https://github.com/sqren/backport)${linkToGithubActionLogs}\n`;
if (backportResponse.status === 'aborted' &&
backportResponse.error.errorContext.code === 'no-branches-exception') {
return `## ⚪ Backport skipped
Expand Down Expand Up @@ -13350,7 +13353,7 @@ exports.maybe = maybe;

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PACKAGE_VERSION = void 0;
exports.PACKAGE_VERSION = '8.9.1';
exports.PACKAGE_VERSION = '8.9.2-link-to-gh-action.1';


/***/ }),
Expand Down Expand Up @@ -126043,7 +126046,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getFailureMessage = exports.run = void 0;
const backport_1 = __nccwpck_require__(25825);
async function run({ context, inputs, }) {
const { payload, repo } = context;
const { payload, repo, runId } = context;
const pullRequest = payload.pull_request;
if (!pullRequest) {
throw Error('Only pull_request events are supported.');
Expand All @@ -126067,6 +126070,7 @@ async function run({ context, inputs, }) {
accessToken: inputs.accessToken,
assignees,
branchLabelMapping,
githubActionRunId: runId,
interactive: false,
publishStatusCommentOnFailure: true,
pullNumber,
Expand Down
1 change: 1 addition & 0 deletions dist/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async function run({ context, inputs, }) {
accessToken: inputs.accessToken,
assignees,
branchLabelMapping,
interactive: false,
publishStatusCommentOnFailure: true,
pullNumber,
repoForkOwner,
Expand Down
5 changes: 3 additions & 2 deletions dist/run.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('run', () => {
branchLabelMapping: {
'^backport-to-(.+)$': '$1',
},
interactive: false,
publishStatusCommentOnFailure: true,
pullNumber: 1345,
repoForkOwner: 'elastic',
Expand Down Expand Up @@ -119,7 +120,7 @@ describe('getFailureMessage', () => {
expect((0, run_1.getFailureMessage)(res)).toBe('My failure');
});
});
describe.only('aborted', () => {
describe('aborted', () => {
it('should error message', () => {
const e = new backport.BackportError({
code: 'abort-conflict-resolution-exception',
Expand All @@ -130,7 +131,7 @@ describe('getFailureMessage', () => {
error: e,
errorMessage: e.message,
};
expect((0, run_1.getFailureMessage)(res)).toBe('Aborted');
expect((0, run_1.getFailureMessage)(res)).toBe('Conflict resolution was aborted by the user');
});
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@actions/github": "^5.0.3",
"@octokit/action": "^4.0.4",
"@octokit/graphql": "^5.0.0",
"backport": "^8.9.1",
"backport": "8.9.2-link-to-gh-action.1",
"husky": "^8.0.1"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function run({
repoForkOwner: string;
};
}) {
const { payload, repo } = context;
const { payload, repo, runId } = context;
const pullRequest = payload.pull_request;

if (!pullRequest) {
Expand Down Expand Up @@ -45,6 +45,7 @@ export async function run({
accessToken: inputs.accessToken,
assignees,
branchLabelMapping,
githubActionRunId: runId,
interactive: false,
publishStatusCommentOnFailure: true,
pullNumber,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1398,10 +1398,10 @@ babel-preset-jest@^28.1.3:
babel-plugin-jest-hoist "^28.1.3"
babel-preset-current-node-syntax "^1.0.0"

backport@^8.9.1:
version "8.9.1"
resolved "https://registry.yarnpkg.com/backport/-/backport-8.9.1.tgz#8ec741919963fd5387ae4fd9f627aaa7ee318b33"
integrity sha512-9pIPuKzDKV3yS4QAFUOsYS0WrO1FE591cQuxeEp6qycuO67x3kJpRZi8JBJxFEnsGDzNq4A8cLFzNl+jPP3A3A==
[email protected].2-link-to-gh-action.1:
version "8.9.2-link-to-gh-action.1"
resolved "https://registry.yarnpkg.com/backport/-/backport-8.9.2-link-to-gh-action.1.tgz#e2fe44cdb8f6294b591d6c57976c7371f20e61f8"
integrity sha512-hY9fBHcKBxuFmA2i4IzQ8gqPWzSGNXzgHujl/mVcb+60cZD8PvzYq23e8HdSs/t5rMMx6drfnZcsmGUr5TC1Vg==
dependencies:
"@octokit/rest" "^19.0.3"
axios "^0.27.2"
Expand Down

0 comments on commit ad29ac1

Please sign in to comment.