From e670035c1adf3729555e2d539a3256ff4015c4b9 Mon Sep 17 00:00:00 2001 From: Lukas Date: Mon, 19 Feb 2024 11:12:39 +0200 Subject: [PATCH 1/7] fix typo --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a242902..4ec7a04 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ name: "GitHub cherry pick action" -description: "GitHub action for cherry pick commits from Pull Requests into Release branchs" +description: "GitHub action for cherry pick commits from Pull Requests into Release branches" inputs: token: description: "GITHUB_TOKEN or a `repo` scoped Personal Access Token (PAT)" From 305f5dca8420cd7ae029be332ce52f3d0b9b25d6 Mon Sep 17 00:00:00 2001 From: Lukas Date: Mon, 19 Feb 2024 11:18:56 +0200 Subject: [PATCH 2/7] use node20 for action --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 4ec7a04..38b29cb 100644 --- a/action.yml +++ b/action.yml @@ -54,7 +54,7 @@ inputs: description: "Forcefully push the branch to remote branch" required: false runs: - using: node16 + using: node20 main: dist/index.js branding: icon: 'git-pull-request' From 57468b574d5692f3176ac4e4a21e6218843cd168 Mon Sep 17 00:00:00 2001 From: Lukas Date: Mon, 19 Feb 2024 11:20:32 +0200 Subject: [PATCH 3/7] bump @types/node to v20 --- package-lock.json | 36 +++++++++++++++++++++++++++--------- package.json | 2 +- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index c98c261..2acf8f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ }, "devDependencies": { "@types/jest": "^26.0.15", - "@types/node": "^18.15.8", + "@types/node": "^20.11.19", "@typescript-eslint/parser": "^5.56.0", "@vercel/ncc": "^0.36.1", "eslint": "^8.36.0", @@ -1734,10 +1734,13 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.15.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.8.tgz", - "integrity": "sha512-kzGNJZ57XEH7RdckxZ7wfRjB9hgZABF+NLgR1B2zogUvV0gmK0/60VYA4yb4oKZckPiiJlmmfpdqTfCN0VRX+Q==", - "dev": true + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", @@ -10366,6 +10369,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", @@ -12276,10 +12285,13 @@ "dev": true }, "@types/node": { - "version": "18.15.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.8.tgz", - "integrity": "sha512-kzGNJZ57XEH7RdckxZ7wfRjB9hgZABF+NLgR1B2zogUvV0gmK0/60VYA4yb4oKZckPiiJlmmfpdqTfCN0VRX+Q==", - "dev": true + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } }, "@types/normalize-package-data": { "version": "2.4.1", @@ -18775,6 +18787,12 @@ "which-boxed-primitive": "^1.0.2" } }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", diff --git a/package.json b/package.json index db39ba9..df238d2 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ }, "devDependencies": { "@types/jest": "^26.0.15", - "@types/node": "^18.15.8", + "@types/node": "^20.11.19", "@typescript-eslint/parser": "^5.56.0", "@vercel/ncc": "^0.36.1", "eslint": "^8.36.0", From d88733281cb92ddc0d1e21058b4044c5686a6fc8 Mon Sep 17 00:00:00 2001 From: Lukas Date: Mon, 19 Feb 2024 11:23:46 +0200 Subject: [PATCH 4/7] bump core deps --- package-lock.json | 28 ++++++++++++++-------------- package.json | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2acf8f4..850fe44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,10 +9,10 @@ "version": "0.0.0", "license": "MIT", "dependencies": { - "@actions/core": "^1.9.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/github": "^5.1.1", - "@actions/io": "^1.1.2", + "@actions/io": "^1.1.3", "@octokit/webhooks-definitions": "^3.67.3" }, "devDependencies": { @@ -32,9 +32,9 @@ } }, "node_modules/@actions/core": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", - "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz", + "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==", "dependencies": { "@actions/http-client": "^2.0.1", "uuid": "^8.3.2" @@ -68,9 +68,9 @@ } }, "node_modules/@actions/io": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz", - "integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", + "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==" }, "node_modules/@ampproject/remapping": { "version": "2.2.0", @@ -10933,9 +10933,9 @@ }, "dependencies": { "@actions/core": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", - "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz", + "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==", "requires": { "@actions/http-client": "^2.0.1", "uuid": "^8.3.2" @@ -10969,9 +10969,9 @@ } }, "@actions/io": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz", - "integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", + "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==" }, "@ampproject/remapping": { "version": "2.2.0", diff --git a/package.json b/package.json index df238d2..2a28e1b 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,10 @@ "author": "", "license": "MIT", "dependencies": { - "@actions/core": "^1.9.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/github": "^5.1.1", - "@actions/io": "^1.1.2", + "@actions/io": "^1.1.3", "@octokit/webhooks-definitions": "^3.67.3" }, "devDependencies": { From 67fac81259ae6359f5c950894f99b458ea254fb8 Mon Sep 17 00:00:00 2001 From: Lukas Date: Mon, 19 Feb 2024 11:30:13 +0200 Subject: [PATCH 5/7] Use not-deprecated package --- package-lock.json | 19 +++++++++---------- package.json | 2 +- src/github-helper.ts | 4 ++-- src/index.ts | 5 +++-- test/index.test.ts | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 850fe44..5c18532 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@actions/exec": "^1.1.1", "@actions/github": "^5.1.1", "@actions/io": "^1.1.3", - "@octokit/webhooks-definitions": "^3.67.3" + "@octokit/webhooks-types": "^7.3.2" }, "devDependencies": { "@types/jest": "^26.0.15", @@ -1604,11 +1604,10 @@ "@octokit/openapi-types": "^12.11.0" } }, - "node_modules/@octokit/webhooks-definitions": { - "version": "3.67.3", - "resolved": "https://registry.npmjs.org/@octokit/webhooks-definitions/-/webhooks-definitions-3.67.3.tgz", - "integrity": "sha512-do4Z1r2OVhuI0ihJhQ8Hg+yPWnBYEBNuFNCrvtPKoYT1w81jD7pBXgGe86lYuuNirkDHb0Nxt+zt4O5GiFJfgA==", - "deprecated": "Use @octokit/webhooks-types, @octokit/webhooks-schemas, or @octokit/webhooks-examples instead. See https://github.com/octokit/webhooks/issues/447" + "node_modules/@octokit/webhooks-types": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.3.2.tgz", + "integrity": "sha512-JWOoOgtWTFnTSAamPXXyjTY5/apttvNxF+vPBnwdSu5cj5snrd7FO0fyw4+wTXy8fHduq626JjhO+TwCyyA6vA==" }, "node_modules/@sinonjs/commons": { "version": "1.8.6", @@ -12159,10 +12158,10 @@ "@octokit/openapi-types": "^12.11.0" } }, - "@octokit/webhooks-definitions": { - "version": "3.67.3", - "resolved": "https://registry.npmjs.org/@octokit/webhooks-definitions/-/webhooks-definitions-3.67.3.tgz", - "integrity": "sha512-do4Z1r2OVhuI0ihJhQ8Hg+yPWnBYEBNuFNCrvtPKoYT1w81jD7pBXgGe86lYuuNirkDHb0Nxt+zt4O5GiFJfgA==" + "@octokit/webhooks-types": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.3.2.tgz", + "integrity": "sha512-JWOoOgtWTFnTSAamPXXyjTY5/apttvNxF+vPBnwdSu5cj5snrd7FO0fyw4+wTXy8fHduq626JjhO+TwCyyA6vA==" }, "@sinonjs/commons": { "version": "1.8.6", diff --git a/package.json b/package.json index 2a28e1b..5746f58 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@actions/exec": "^1.1.1", "@actions/github": "^5.1.1", "@actions/io": "^1.1.3", - "@octokit/webhooks-definitions": "^3.67.3" + "@octokit/webhooks-types": "^7.3.2" }, "devDependencies": { "@types/jest": "^26.0.15", diff --git a/src/github-helper.ts b/src/github-helper.ts index ad00fd6..4bca9b3 100644 --- a/src/github-helper.ts +++ b/src/github-helper.ts @@ -1,6 +1,6 @@ import * as github from '@actions/github' import * as core from '@actions/core' -import {PullRequest} from '@octokit/webhooks-definitions/schema' +import {PullRequest} from '@octokit/webhooks-types' const ERROR_PR_REVIEW_FROM_AUTHOR = 'Review cannot be requested from pull request author' @@ -50,7 +50,7 @@ export async function createPullRequest( core.info(`Input body is '${inputs.body}'`) let body = inputs.body if (body === undefined || body === '') { - body = pull_request.body + body = pull_request.body || undefined } else { // if the body comes from inputs, we replace {old_pull_request_id} // to make it easy to reference the previous pull request in the new diff --git a/src/index.ts b/src/index.ts index 46d957f..12523b8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,7 @@ import * as exec from '@actions/exec' import * as utils from './utils' import * as github from '@actions/github' import {Inputs, createPullRequest} from './github-helper' -import { PullRequest } from '@octokit/webhooks-definitions/schema' +import {PullRequest} from '@octokit/webhooks-types' const CHERRYPICK_EMPTY = 'The previous cherry-pick is now empty, possibly due to conflict resolution.' @@ -31,7 +31,8 @@ export async function run(): Promise { // the value of merge_commit_sha changes depending on the status of the pull request // see https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request - const githubSha = (github.context.payload.pull_request as PullRequest).merge_commit_sha + const githubSha = (github.context.payload.pull_request as PullRequest) + .merge_commit_sha const prBranch = inputs.cherryPickBranch ? inputs.cherryPickBranch : `cherry-pick-${inputs.branch}-${githubSha}` diff --git a/test/index.test.ts b/test/index.test.ts index cce0744..80e5e9a 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -2,7 +2,7 @@ import * as core from '@actions/core' import * as exec from '@actions/exec' import {run} from '../src/index' import {createPullRequest} from '../src/github-helper' -import { PullRequest } from '@octokit/webhooks-definitions/schema' +import { PullRequest } from '@octokit/webhooks-types' const defaultMockedGetInputData: any = { token: 'whatever', From 2e0791cc6799e90eab6b292c3cb02b5a8d19dda4 Mon Sep 17 00:00:00 2001 From: Lukas Date: Mon, 19 Feb 2024 11:50:32 +0200 Subject: [PATCH 6/7] Run `format` --- test/index.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.test.ts b/test/index.test.ts index 80e5e9a..5d124fb 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -2,7 +2,7 @@ import * as core from '@actions/core' import * as exec from '@actions/exec' import {run} from '../src/index' import {createPullRequest} from '../src/github-helper' -import { PullRequest } from '@octokit/webhooks-types' +import {PullRequest} from '@octokit/webhooks-types' const defaultMockedGetInputData: any = { token: 'whatever', From 159a73ae68f9894be47fcce2de018fcaebe99152 Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 27 Mar 2024 10:37:30 +0200 Subject: [PATCH 7/7] Bump `@octokit/webhooks-types` to latest --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index a17cc0f..1c4fcf8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@actions/exec": "^1.1.1", "@actions/github": "^6.0.0", "@actions/io": "^1.1.3", - "@octokit/webhooks-types": "^7.3.2" + "@octokit/webhooks-types": "^7.4.0" }, "devDependencies": { "@types/jest": "^29.5.12", @@ -1895,9 +1895,9 @@ } }, "node_modules/@octokit/webhooks-types": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.3.2.tgz", - "integrity": "sha512-JWOoOgtWTFnTSAamPXXyjTY5/apttvNxF+vPBnwdSu5cj5snrd7FO0fyw4+wTXy8fHduq626JjhO+TwCyyA6vA==" + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.4.0.tgz", + "integrity": "sha512-FE2V+QZ2UYlh+9wWd5BPLNXG+J/XUD/PPq0ovS+nCcGX4+3qVbi3jYOmCTW48hg9SBBLtInx9+o7fFt4H5iP0Q==" }, "node_modules/@pkgr/core": { "version": "0.1.1", @@ -9791,9 +9791,9 @@ } }, "@octokit/webhooks-types": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.3.2.tgz", - "integrity": "sha512-JWOoOgtWTFnTSAamPXXyjTY5/apttvNxF+vPBnwdSu5cj5snrd7FO0fyw4+wTXy8fHduq626JjhO+TwCyyA6vA==" + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.4.0.tgz", + "integrity": "sha512-FE2V+QZ2UYlh+9wWd5BPLNXG+J/XUD/PPq0ovS+nCcGX4+3qVbi3jYOmCTW48hg9SBBLtInx9+o7fFt4H5iP0Q==" }, "@pkgr/core": { "version": "0.1.1", diff --git a/package.json b/package.json index 81f90d4..670d7f3 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@actions/exec": "^1.1.1", "@actions/github": "^6.0.0", "@actions/io": "^1.1.3", - "@octokit/webhooks-types": "^7.3.2" + "@octokit/webhooks-types": "^7.4.0" }, "devDependencies": { "@types/jest": "^29.5.12",