From 5e590a18dd7ddb5d51139c1b4e8659cf8c6ba8c5 Mon Sep 17 00:00:00 2001 From: BetaHuhn Date: Sun, 7 Mar 2021 23:45:38 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Improve=20code=20structure?= =?UTF-8?q?/readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.js | 259 +++++++++++++++++++++++-------------------------- src/config.js | 8 +- src/git.js | 65 ++++++------- src/helpers.js | 15 ++- src/index.js | 167 +++++++++++++++---------------- 5 files changed, 242 insertions(+), 272 deletions(-) diff --git a/dist/index.js b/dist/index.js index 861ef948..a72a8bf0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -30253,13 +30253,7 @@ const context = { core.setSecret(context.GITHUB_TOKEN) -core.debug( - JSON.stringify( - context, - null, - 2 - ) -) +core.debug(JSON.stringify(context, null, 2)) const parseRepoName = (fullRepo) => { let host = 'github.com' @@ -30389,24 +30383,23 @@ const { GITHUB_REPOSITORY, OVERWRITE_EXISTING_PR } = __nccwpck_require__(4570) -const { dedent } = __nccwpck_require__(8505) +const { dedent } = __nccwpck_require__(8505) const init = (repo) => { - let github let baseBranch let prBranch let existingPr - const localPath = path.join(TMP_DIR, repo.fullName) + const workingDir = path.join(TMP_DIR, repo.fullName) const gitUrl = `https://${ GITHUB_TOKEN }@${ repo.fullName }.git` const clone = () => { - core.info(`Cloning ${ repo.fullName } into ${ localPath }`) + core.debug(`Cloning ${ repo.fullName } into ${ workingDir }`) return execCmd( - `git clone --depth 1 ${ repo.branch !== 'default' ? '--branch "' + repo.branch + '"' : '' } ${ gitUrl } ${ localPath }` + `git clone --depth 1 ${ repo.branch !== 'default' ? '--branch "' + repo.branch + '"' : '' } ${ gitUrl } ${ workingDir }` ) } @@ -30421,78 +30414,74 @@ const init = (repo) => { username = data.login } - core.info(`Setting git user to email: ${ email }, username: ${ username }`) + core.debug(`Setting git user to email: ${ email }, username: ${ username }`) return execCmd( `git config --local user.name "${ username }" && git config --local user.email "${ email }"`, - localPath + workingDir ) } const getBaseBranch = async () => { baseBranch = await execCmd( `git rev-parse --abbrev-ref HEAD`, - localPath + workingDir ) } const createPrBranch = async () => { - return new Promise((resolve, reject) => { - let newBranch = `repo-sync/${ GITHUB_REPOSITORY.split('/')[1] }/${ repo.branch }` + let newBranch = `repo-sync/${ GITHUB_REPOSITORY.split('/')[1] }/${ repo.branch }` - if (OVERWRITE_EXISTING_PR === false) { - newBranch += `-${ Math.round((new Date()).getTime() / 1000) }` - } + if (OVERWRITE_EXISTING_PR === false) { + newBranch += `-${ Math.round((new Date()).getTime() / 1000) }` + } - core.info(`Creating PR Branch ${ newBranch }`) + core.debug(`Creating PR Branch ${ newBranch }`) - execCmd( - `git checkout -b "${ newBranch }"`, - localPath - ).catch((err) => { - reject(err) - }).then(() => { - prBranch = newBranch - resolve() - }) - }) + await execCmd( + `git checkout -b "${ newBranch }"`, + workingDir + ) + + prBranch = newBranch } const add = async (file) => { return execCmd( `git add -f ${ file }`, - localPath + workingDir ) } - const hasChange = async () => { + const hasChanges = async () => { const statusOutput = await execCmd( `git status --porcelain`, - localPath + workingDir ) + return parse(statusOutput).length !== 0 } const commit = async (msg) => { const message = msg !== undefined ? msg : `${ COMMIT_PREFIX } Synced file(s) with ${ GITHUB_REPOSITORY }` + return execCmd( `git commit -m "${ message }"`, - localPath + workingDir ) } const status = async () => { return execCmd( `git status`, - localPath + workingDir ) } - const push = async ({ force }) => { - console.log(force) + const push = async () => { return execCmd( - `git push ${ gitUrl } ${ force ? '--force' : '' }`, - localPath + `git push ${ gitUrl } --force`, + workingDir ) } @@ -30570,13 +30559,13 @@ const init = (repo) => { } return { - localPath, + workingDir, clone, setIdentity, getBaseBranch, createPrBranch, add, - hasChange, + hasChanges, commit, status, push, @@ -30609,7 +30598,9 @@ module.exports = { /***/ }), /***/ 8505: -/***/ ((module) => { +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const fs = __nccwpck_require__(5747) // From https://github.com/toniov/p-iteration/blob/master/lib/static-methods.js - MIT © Antonio V const forEach = async (array, callback) => { @@ -30619,7 +30610,7 @@ const forEach = async (array, callback) => { } } -// From https://github.com/MartinKolarik/dedent-js/blob/master/src/index.ts - Copyright (c) 2015 Martin Kolárik. Released under the MIT license. +// From https://github.com/MartinKolarik/dedent-js/blob/master/src/index.ts - MIT © 2015 Martin Kolárik const dedent = function(templateStrings, ...values) { const matches = [] const strings = typeof templateStrings === 'string' ? [ templateStrings ] : templateStrings.slice() @@ -30646,9 +30637,18 @@ const dedent = function(templateStrings, ...values) { return string } +const addTrailingSlash = (str) => str.endsWith('/') ? str : str + '/' + +const pathIsDirectory = async (path) => { + const stat = await fs.promises.lstat(path) + return stat.isDirectory() +} + module.exports = { forEach, - dedent + dedent, + addTrailingSlash, + pathIsDirectory } /***/ }), @@ -30662,7 +30662,7 @@ const io = __nccwpck_require__(7436) const fs = __nccwpck_require__(5747) const Git = __nccwpck_require__(109) -const { forEach, dedent } = __nccwpck_require__(8505) +const { forEach, dedent, addTrailingSlash, pathIsDirectory } = __nccwpck_require__(8505) const { parseConfig, @@ -30692,137 +30692,122 @@ const run = async () => { try { const git = Git.init(item.repo) + // Clone and setup the git repository locally await git.clone() await git.setIdentity(client) await git.getBaseBranch() await git.createPrBranch() - const existingPr = OVERWRITE_EXISTING_PR === true ? await git.findExistingPr() : undefined - if (existingPr !== undefined && DRY_RUN === false) { + // Check for existing PR and add warning message that the PR maybe about to change + const existingPr = OVERWRITE_EXISTING_PR && await git.findExistingPr() + if (existingPr && DRY_RUN === false) { core.info(`Found existing PR ${ existingPr.number }`) await git.setPrWarning() } const modified = [] + // Loop through all selected files of the source repo await forEach(item.files, async (file) => { + core.info(`Looking for changed files`) + const fileExists = fs.existsSync(file.source) - if (fileExists === false) { - core.warning(`Source ${ file.source } not found`) - return - } + if (fileExists === false) return core.warning(`Source ${ file.source } not found`) - const stat = await fs.promises.lstat(file.source) - const isFile = stat.isFile() - if (isFile === false) { - core.warning(`Source is directory`) - } + const localDestination = `${ git.workingDir }/${ file.dest }` - const dest = `${ git.localPath }/${ file.dest }` - const destExists = fs.existsSync(dest) - if (destExists === true && file.replace === false) { - core.warning(`File(s) already exist(s) in destination and 'replace' option is set to false`) - return - } + const destExists = fs.existsSync(localDestination) + if (destExists === true && file.replace === false) return core.warning(`File(s) already exist(s) in destination and 'replace' option is set to false`) - const addTrailingSlash = (str) => str.endsWith('/') ? str : str + '/' - const copySource = (isFile === false) ? `${ addTrailingSlash(file.source) }` : file.source - - core.info(`Copying ${ copySource } to ${ dest }`) - await io.cp(copySource, dest, { recursive: true, force: true }).catch((err) => { - core.error(`Unable to copy file(s).`) - core.error(err) - }).then(async () => { - await git.add(file.dest) - - if (COMMIT_EACH_FILE === true) { - const hasChange = await git.hasChange() - if (hasChange === false) { - core.info('File(s) already up to date') - return - } + const isDirectory = await pathIsDirectory(file.source) + const source = isDirectory ? `${ addTrailingSlash(file.source) }` : file.source - core.info(`Creating commit for file(s) ${ file.dest }`) - - let message - let prMessage - const directory = isFile === false ? 'directory' : '' - const otherFiles = isFile === false ? 'and copied all sub files/folders' : '' - if (destExists) { - message = `${ COMMIT_PREFIX } Synced local '${ file.dest }' with remote '${ file.source }'` - prMessage = `Synced local ${ directory } ${ file.dest } with remote ${ directory } ${ file.source }` - } else { - message = `${ COMMIT_PREFIX } Created local '${ file.dest }' from remote '${ file.source }'` - prMessage = `Created local ${ directory } ${ file.dest } ${ otherFiles } from remote ${ directory } ${ file.source }` - } + if (isDirectory) core.warning(`Source is directory`) + + core.debug(`Copying ${ source } to ${ localDestination }`) + await io.cp(source, localDestination, { recursive: true, force: true }) - await git.commit(message) - modified.push({ - dest: file.dest, - source: file.source, - message: prMessage - }) + await git.add(file.dest) + + // Commit each file seperately, if option is set to false, commit all files at once later + if (COMMIT_EACH_FILE === true) { + const hasChanges = await git.hasChanges() + + if (hasChanges === false) return core.debug('File(s) already up to date') + + core.debug(`Creating commit for file(s) ${ file.dest }`) + + // Use different commit/pr message based on if the source is a directory or file + const directory = isDirectory ? 'directory' : '' + const otherFiles = isDirectory ? 'and copied all sub files/folders' : '' + + const message = { + true: { + commit: `${ COMMIT_PREFIX } Synced local '${ file.dest }' with remote '${ file.source }'`, + pr: `Synced local ${ directory } ${ file.dest } with remote ${ directory } ${ file.source }` + }, + false: { + commit: `${ COMMIT_PREFIX } Created local '${ file.dest }' from remote '${ file.source }'`, + pr: `Created local ${ directory } ${ file.dest } ${ otherFiles } from remote ${ directory } ${ file.source }` + } } - }) + + // Commit and add file to modified array so we later know if there are any changes to actually push + await git.commit(message[destExists].commit) + modified.push({ + dest: file.dest, + source: file.source, + message: message[destExists].pr + }) + } }) if (DRY_RUN) { core.warning('Dry run, no changes will be pushed') - core.info('Git Status') - core.info(await git.status()) - return - } - const hasChange = await git.hasChange() - if (hasChange === false && COMMIT_EACH_FILE === false) { - core.info('File(s) already up to date') - - if (existingPr) await git.removePrWarning() + core.debug('Git Status:') + core.debug(await git.status()) return } - if (hasChange === true) { - core.info(`Creating commit for remaining files`) - await git.commit() - modified.push({ - dest: git.localPath - }) - } + const hasChanges = await git.hasChanges() - if (modified.length < 1) { - core.info('Nothing to push') + // If no changes left and nothing was modified we can assume nothing has changed/needs to be pushed + if (hasChanges === false && modified.length < 1) { + core.info('File(s) already up to date') if (existingPr) await git.removePrWarning() return } - core.info(`Pushing changes to remote`) - await git.push({ force: true }) // Maybe first check if branch already exists in remote + // If there are still local changes left (i.e. not committed each file seperately), commit them before pushing + if (hasChanges === true) { + core.debug(`Creating commit for remaining files`) - let changedFiles = '' - let list = `` - - if (COMMIT_EACH_FILE === true) { - modified.forEach((file) => { - list += `
  • ${ file.message }
  • ` + await git.commit() + modified.push({ + dest: git.workingDir }) - - changedFiles = dedent(` -
    - Changed files - -
    - `) } - const pullRequest = await git.createOrUpdatePr(changedFiles) + core.info(`Pushing changes to target repository`) + await git.push() + + // If each file was committed seperately, list them in the PR description + const changedFiles = dedent(` +
    + Changed files + +
    + `) + + const pullRequest = await git.createOrUpdatePr(COMMIT_EACH_FILE ? changedFiles : '') - core.info(`Pull Request Created/Updated: #${ pullRequest.number }`) - core.info(`${ pullRequest.html_url }`) + core.info(`Pull Request #${ pullRequest.number } created/updated: ${ pullRequest.html_url }`) core.setOutput('pull_request_number', pullRequest.number) core.setOutput('pull_request_url', pullRequest.html_url) diff --git a/src/config.js b/src/config.js index ffb382e6..b8a68853 100644 --- a/src/config.js +++ b/src/config.js @@ -93,13 +93,7 @@ const context = { core.setSecret(context.GITHUB_TOKEN) -core.debug( - JSON.stringify( - context, - null, - 2 - ) -) +core.debug(JSON.stringify(context, null, 2)) const parseRepoName = (fullRepo) => { let host = 'github.com' diff --git a/src/git.js b/src/git.js index ebec1e94..0ccbbc91 100644 --- a/src/git.js +++ b/src/git.js @@ -12,24 +12,23 @@ const { GITHUB_REPOSITORY, OVERWRITE_EXISTING_PR } = require('./config') -const { dedent } = require('./helpers') +const { dedent } = require('./helpers') const init = (repo) => { - let github let baseBranch let prBranch let existingPr - const localPath = path.join(TMP_DIR, repo.fullName) + const workingDir = path.join(TMP_DIR, repo.fullName) const gitUrl = `https://${ GITHUB_TOKEN }@${ repo.fullName }.git` const clone = () => { - core.info(`Cloning ${ repo.fullName } into ${ localPath }`) + core.debug(`Cloning ${ repo.fullName } into ${ workingDir }`) return execCmd( - `git clone --depth 1 ${ repo.branch !== 'default' ? '--branch "' + repo.branch + '"' : '' } ${ gitUrl } ${ localPath }` + `git clone --depth 1 ${ repo.branch !== 'default' ? '--branch "' + repo.branch + '"' : '' } ${ gitUrl } ${ workingDir }` ) } @@ -44,78 +43,74 @@ const init = (repo) => { username = data.login } - core.info(`Setting git user to email: ${ email }, username: ${ username }`) + core.debug(`Setting git user to email: ${ email }, username: ${ username }`) return execCmd( `git config --local user.name "${ username }" && git config --local user.email "${ email }"`, - localPath + workingDir ) } const getBaseBranch = async () => { baseBranch = await execCmd( `git rev-parse --abbrev-ref HEAD`, - localPath + workingDir ) } const createPrBranch = async () => { - return new Promise((resolve, reject) => { - let newBranch = `repo-sync/${ GITHUB_REPOSITORY.split('/')[1] }/${ repo.branch }` + let newBranch = `repo-sync/${ GITHUB_REPOSITORY.split('/')[1] }/${ repo.branch }` - if (OVERWRITE_EXISTING_PR === false) { - newBranch += `-${ Math.round((new Date()).getTime() / 1000) }` - } + if (OVERWRITE_EXISTING_PR === false) { + newBranch += `-${ Math.round((new Date()).getTime() / 1000) }` + } - core.info(`Creating PR Branch ${ newBranch }`) + core.debug(`Creating PR Branch ${ newBranch }`) - execCmd( - `git checkout -b "${ newBranch }"`, - localPath - ).catch((err) => { - reject(err) - }).then(() => { - prBranch = newBranch - resolve() - }) - }) + await execCmd( + `git checkout -b "${ newBranch }"`, + workingDir + ) + + prBranch = newBranch } const add = async (file) => { return execCmd( `git add -f ${ file }`, - localPath + workingDir ) } - const hasChange = async () => { + const hasChanges = async () => { const statusOutput = await execCmd( `git status --porcelain`, - localPath + workingDir ) + return parse(statusOutput).length !== 0 } const commit = async (msg) => { const message = msg !== undefined ? msg : `${ COMMIT_PREFIX } Synced file(s) with ${ GITHUB_REPOSITORY }` + return execCmd( `git commit -m "${ message }"`, - localPath + workingDir ) } const status = async () => { return execCmd( `git status`, - localPath + workingDir ) } - const push = async ({ force }) => { - console.log(force) + const push = async () => { return execCmd( - `git push ${ gitUrl } ${ force ? '--force' : '' }`, - localPath + `git push ${ gitUrl } --force`, + workingDir ) } @@ -193,13 +188,13 @@ const init = (repo) => { } return { - localPath, + workingDir, clone, setIdentity, getBaseBranch, createPrBranch, add, - hasChange, + hasChanges, commit, status, push, diff --git a/src/helpers.js b/src/helpers.js index ff696178..2354569c 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,3 +1,5 @@ +const fs = require('fs') + // From https://github.com/toniov/p-iteration/blob/master/lib/static-methods.js - MIT © Antonio V const forEach = async (array, callback) => { for (let index = 0; index < array.length; index++) { @@ -6,7 +8,7 @@ const forEach = async (array, callback) => { } } -// From https://github.com/MartinKolarik/dedent-js/blob/master/src/index.ts - Copyright (c) 2015 Martin Kolárik. Released under the MIT license. +// From https://github.com/MartinKolarik/dedent-js/blob/master/src/index.ts - MIT © 2015 Martin Kolárik const dedent = function(templateStrings, ...values) { const matches = [] const strings = typeof templateStrings === 'string' ? [ templateStrings ] : templateStrings.slice() @@ -33,7 +35,16 @@ const dedent = function(templateStrings, ...values) { return string } +const addTrailingSlash = (str) => str.endsWith('/') ? str : str + '/' + +const pathIsDirectory = async (path) => { + const stat = await fs.promises.lstat(path) + return stat.isDirectory() +} + module.exports = { forEach, - dedent + dedent, + addTrailingSlash, + pathIsDirectory } \ No newline at end of file diff --git a/src/index.js b/src/index.js index be9d5490..0ad87330 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,7 @@ const io = require('@actions/io') const fs = require('fs') const Git = require('./git') -const { forEach, dedent } = require('./helpers') +const { forEach, dedent, addTrailingSlash, pathIsDirectory } = require('./helpers') const { parseConfig, @@ -34,89 +34,89 @@ const run = async () => { try { const git = Git.init(item.repo) + // Clone and setup the git repository locally await git.clone() await git.setIdentity(client) await git.getBaseBranch() await git.createPrBranch() - const existingPr = OVERWRITE_EXISTING_PR === true ? await git.findExistingPr() : undefined - if (existingPr !== undefined && DRY_RUN === false) { + // Check for existing PR and add warning message that the PR maybe about to change + const existingPr = OVERWRITE_EXISTING_PR && await git.findExistingPr() + if (existingPr && DRY_RUN === false) { core.info(`Found existing PR ${ existingPr.number }`) await git.setPrWarning() } const modified = [] + // Loop through all selected files of the source repo await forEach(item.files, async (file) => { + core.info(`Looking for changed files`) + const fileExists = fs.existsSync(file.source) - if (fileExists === false) { - core.warning(`Source ${ file.source } not found`) - return - } + if (fileExists === false) return core.warning(`Source ${ file.source } not found`) - const stat = await fs.promises.lstat(file.source) - const isFile = stat.isFile() - if (isFile === false) { - core.warning(`Source is directory`) - } + const localDestination = `${ git.workingDir }/${ file.dest }` - const dest = `${ git.localPath }/${ file.dest }` - const destExists = fs.existsSync(dest) - if (destExists === true && file.replace === false) { - core.warning(`File(s) already exist(s) in destination and 'replace' option is set to false`) - return - } + const destExists = fs.existsSync(localDestination) + if (destExists === true && file.replace === false) return core.warning(`File(s) already exist(s) in destination and 'replace' option is set to false`) - const addTrailingSlash = (str) => str.endsWith('/') ? str : str + '/' - const copySource = (isFile === false) ? `${ addTrailingSlash(file.source) }` : file.source - - core.info(`Copying ${ copySource } to ${ dest }`) - await io.cp(copySource, dest, { recursive: true, force: true }).catch((err) => { - core.error(`Unable to copy file(s).`) - core.error(err) - }).then(async () => { - await git.add(file.dest) - - if (COMMIT_EACH_FILE === true) { - const hasChange = await git.hasChange() - if (hasChange === false) { - core.info('File(s) already up to date') - return - } + const isDirectory = await pathIsDirectory(file.source) + const source = isDirectory ? `${ addTrailingSlash(file.source) }` : file.source - core.info(`Creating commit for file(s) ${ file.dest }`) - - let message - let prMessage - const directory = isFile === false ? 'directory' : '' - const otherFiles = isFile === false ? 'and copied all sub files/folders' : '' - if (destExists) { - message = `${ COMMIT_PREFIX } Synced local '${ file.dest }' with remote '${ file.source }'` - prMessage = `Synced local ${ directory } ${ file.dest } with remote ${ directory } ${ file.source }` - } else { - message = `${ COMMIT_PREFIX } Created local '${ file.dest }' from remote '${ file.source }'` - prMessage = `Created local ${ directory } ${ file.dest } ${ otherFiles } from remote ${ directory } ${ file.source }` - } + if (isDirectory) core.warning(`Source is directory`) + + core.debug(`Copying ${ source } to ${ localDestination }`) + await io.cp(source, localDestination, { recursive: true, force: true }) + + await git.add(file.dest) - await git.commit(message) - modified.push({ - dest: file.dest, - source: file.source, - message: prMessage - }) + // Commit each file seperately, if option is set to false, commit all files at once later + if (COMMIT_EACH_FILE === true) { + const hasChanges = await git.hasChanges() + + if (hasChanges === false) return core.debug('File(s) already up to date') + + core.debug(`Creating commit for file(s) ${ file.dest }`) + + // Use different commit/pr message based on if the source is a directory or file + const directory = isDirectory ? 'directory' : '' + const otherFiles = isDirectory ? 'and copied all sub files/folders' : '' + + const message = { + true: { + commit: `${ COMMIT_PREFIX } Synced local '${ file.dest }' with remote '${ file.source }'`, + pr: `Synced local ${ directory } ${ file.dest } with remote ${ directory } ${ file.source }` + }, + false: { + commit: `${ COMMIT_PREFIX } Created local '${ file.dest }' from remote '${ file.source }'`, + pr: `Created local ${ directory } ${ file.dest } ${ otherFiles } from remote ${ directory } ${ file.source }` + } } - }) + + // Commit and add file to modified array so we later know if there are any changes to actually push + await git.commit(message[destExists].commit) + modified.push({ + dest: file.dest, + source: file.source, + message: message[destExists].pr + }) + } }) if (DRY_RUN) { core.warning('Dry run, no changes will be pushed') - core.info('Git Status') - core.info(await git.status()) + + core.debug('Git Status:') + core.debug(await git.status()) + return } - const hasChange = await git.hasChange() - if (hasChange === false && COMMIT_EACH_FILE === false) { + const hasChanges = await git.hasChanges() + + // If no changes left and nothing was modified we can assume nothing has changed/needs to be pushed + if (hasChanges === false && modified.length < 1) { core.info('File(s) already up to date') if (existingPr) await git.removePrWarning() @@ -124,47 +124,32 @@ const run = async () => { return } - if (hasChange === true) { - core.info(`Creating commit for remaining files`) + // If there are still local changes left (i.e. not committed each file seperately), commit them before pushing + if (hasChanges === true) { + core.debug(`Creating commit for remaining files`) + await git.commit() modified.push({ - dest: git.localPath + dest: git.workingDir }) } - if (modified.length < 1) { - core.info('Nothing to push') - - if (existingPr) await git.removePrWarning() + core.info(`Pushing changes to target repository`) + await git.push() - return - } - - core.info(`Pushing changes to remote`) - await git.push({ force: true }) // Maybe first check if branch already exists in remote - - let changedFiles = '' - let list = `` - - if (COMMIT_EACH_FILE === true) { - modified.forEach((file) => { - list += `
  • ${ file.message }
  • ` - }) - - changedFiles = dedent(` -
    - Changed files - -
    - `) - } + // If each file was committed seperately, list them in the PR description + const changedFiles = dedent(` +
    + Changed files + +
    + `) - const pullRequest = await git.createOrUpdatePr(changedFiles) + const pullRequest = await git.createOrUpdatePr(COMMIT_EACH_FILE ? changedFiles : '') - core.info(`Pull Request Created/Updated: #${ pullRequest.number }`) - core.info(`${ pullRequest.html_url }`) + core.info(`Pull Request #${ pullRequest.number } created/updated: ${ pullRequest.html_url }`) core.setOutput('pull_request_number', pullRequest.number) core.setOutput('pull_request_url', pullRequest.html_url)