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

Update action runtime to node 16 #1074

Merged
merged 6 commits into from Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -15,9 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: 16.x
cache: npm
- uses: actions/setup-python@v2
with:
python-version: '3.x'
Expand Down
8 changes: 0 additions & 8 deletions __test__/utils.unit.test.ts
Expand Up @@ -17,14 +17,6 @@ describe('utils tests', () => {
}
})

test('getStringAsArray splits string input by newlines and commas', async () => {
const array = utils.getStringAsArray('1, 2, 3\n4, 5, 6')
expect(array.length).toEqual(6)

const array2 = utils.getStringAsArray('')
expect(array2.length).toEqual(0)
})

test('getRepoPath successfully returns the path to the repository', async () => {
expect(utils.getRepoPath()).toEqual(process.env['GITHUB_WORKSPACE'])
expect(utils.getRepoPath('foo')).toEqual(
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Expand Up @@ -81,7 +81,7 @@ outputs:
pull-request-head-sha:
description: 'The commit SHA of the pull request branch.'
runs:
using: 'node12'
using: 'node16'
main: 'dist/index.js'
branding:
icon: 'git-pull-request'
Expand Down
30 changes: 9 additions & 21 deletions dist/index.js
Expand Up @@ -1074,31 +1074,30 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186));
const create_pull_request_1 = __nccwpck_require__(3780);
const util_1 = __nccwpck_require__(3837);
const utils = __importStar(__nccwpck_require__(918));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const inputs = {
token: core.getInput('token'),
path: core.getInput('path'),
addPaths: utils.getInputAsArray('add-paths'),
addPaths: core.getMultilineInput('add-paths'),
commitMessage: core.getInput('commit-message'),
committer: core.getInput('committer'),
author: core.getInput('author'),
signoff: core.getInput('signoff') === 'true',
signoff: core.getBooleanInput('signoff'),
branch: core.getInput('branch'),
deleteBranch: core.getInput('delete-branch') === 'true',
deleteBranch: core.getBooleanInput('delete-branch'),
branchSuffix: core.getInput('branch-suffix'),
base: core.getInput('base'),
pushToFork: core.getInput('push-to-fork'),
title: core.getInput('title'),
body: core.getInput('body'),
labels: utils.getInputAsArray('labels'),
assignees: utils.getInputAsArray('assignees'),
reviewers: utils.getInputAsArray('reviewers'),
teamReviewers: utils.getInputAsArray('team-reviewers'),
labels: core.getMultilineInput('labels'),
assignees: core.getMultilineInput('assignees'),
reviewers: core.getMultilineInput('reviewers'),
teamReviewers: core.getMultilineInput('team-reviewers'),
milestone: Number(core.getInput('milestone')),
draft: core.getInput('draft') === 'true'
draft: core.getBooleanInput('draft')
};
core.debug(`Inputs: ${(0, util_1.inspect)(inputs)}`);
yield (0, create_pull_request_1.createPullRequest)(inputs);
Expand Down Expand Up @@ -1164,21 +1163,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.fileExistsSync = exports.parseDisplayNameEmail = exports.randomString = exports.secondsSinceEpoch = exports.getRemoteUrl = exports.getRemoteDetail = exports.getRepoPath = exports.getStringAsArray = exports.getInputAsArray = void 0;
exports.fileExistsSync = exports.parseDisplayNameEmail = exports.randomString = exports.secondsSinceEpoch = exports.getRemoteUrl = exports.getRemoteDetail = exports.getRepoPath = void 0;
const core = __importStar(__nccwpck_require__(2186));
const fs = __importStar(__nccwpck_require__(7147));
const path = __importStar(__nccwpck_require__(1017));
function getInputAsArray(name, options) {
return getStringAsArray(core.getInput(name, options));
}
exports.getInputAsArray = getInputAsArray;
function getStringAsArray(str) {
return str
.split(/[\n,]+/)
.map(s => s.trim())
.filter(x => x !== '');
}
exports.getStringAsArray = getStringAsArray;
function getRepoPath(relativePath) {
let githubWorkspacePath = process.env['GITHUB_WORKSPACE'];
if (!githubWorkspacePath) {
Expand Down
17 changes: 8 additions & 9 deletions src/main.ts
@@ -1,31 +1,30 @@
import * as core from '@actions/core'
import {Inputs, createPullRequest} from './create-pull-request'
import {inspect} from 'util'
import * as utils from './utils'

async function run(): Promise<void> {
try {
const inputs: Inputs = {
token: core.getInput('token'),
path: core.getInput('path'),
addPaths: utils.getInputAsArray('add-paths'),
addPaths: core.getMultilineInput('add-paths'),
peter-evans marked this conversation as resolved.
Show resolved Hide resolved
commitMessage: core.getInput('commit-message'),
committer: core.getInput('committer'),
author: core.getInput('author'),
signoff: core.getInput('signoff') === 'true',
signoff: core.getBooleanInput('signoff'),
peter-evans marked this conversation as resolved.
Show resolved Hide resolved
branch: core.getInput('branch'),
deleteBranch: core.getInput('delete-branch') === 'true',
deleteBranch: core.getBooleanInput('delete-branch'),
branchSuffix: core.getInput('branch-suffix'),
base: core.getInput('base'),
pushToFork: core.getInput('push-to-fork'),
title: core.getInput('title'),
body: core.getInput('body'),
labels: utils.getInputAsArray('labels'),
assignees: utils.getInputAsArray('assignees'),
reviewers: utils.getInputAsArray('reviewers'),
teamReviewers: utils.getInputAsArray('team-reviewers'),
labels: core.getMultilineInput('labels'),
assignees: core.getMultilineInput('assignees'),
reviewers: core.getMultilineInput('reviewers'),
teamReviewers: core.getMultilineInput('team-reviewers'),
milestone: Number(core.getInput('milestone')),
draft: core.getInput('draft') === 'true'
draft: core.getBooleanInput('draft')
}
core.debug(`Inputs: ${inspect(inputs)}`)

Expand Down
14 changes: 0 additions & 14 deletions src/utils.ts
Expand Up @@ -2,20 +2,6 @@ import * as core from '@actions/core'
import * as fs from 'fs'
import * as path from 'path'

export function getInputAsArray(
name: string,
options?: core.InputOptions
): string[] {
return getStringAsArray(core.getInput(name, options))
}

export function getStringAsArray(str: string): string[] {
return str
.split(/[\n,]+/)
.map(s => s.trim())
.filter(x => x !== '')
}

export function getRepoPath(relativePath?: string): string {
let githubWorkspacePath = process.env['GITHUB_WORKSPACE']
if (!githubWorkspacePath) {
Expand Down