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

Bump action Node version to v20 #148

Merged
merged 8 commits into from
Mar 27, 2024
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
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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)"
Expand Down Expand Up @@ -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'
Expand Down
19 changes: 9 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"@actions/io": "^1.1.3",
"@octokit/webhooks-definitions": "^3.67.3"
"@octokit/webhooks-types": "^7.4.0"
},
"devDependencies": {
"@types/jest": "^29.5.12",
Expand Down
4 changes: 2 additions & 2 deletions src/github-helper.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -31,7 +31,8 @@ export async function run(): Promise<void> {

// 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}`
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down