-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
359 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41876,7 +41876,27 @@ const core = __importStar(__webpack_require__(470)); | |
const github_1 = __webpack_require__(469); | ||
const netlify_1 = __importDefault(__webpack_require__(326)); | ||
const path = __importStar(__webpack_require__(622)); | ||
function run() { | ||
const inputs_1 = __webpack_require__(840); | ||
const commentIdentifierString = '<!-- NETLIFY DEPLOY COMMENT GENERATED BY ACTIONS_NETLIFY -->'; | ||
function findIssueComment(githubClient) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const listCommentsRes = yield githubClient.issues.listComments({ | ||
owner: github_1.context.issue.owner, | ||
repo: github_1.context.issue.repo, | ||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
issue_number: github_1.context.issue.number | ||
}); | ||
const comments = listCommentsRes.data; | ||
for (const comment of comments) { | ||
// If comment contains the comment identifier | ||
if (comment.body.includes(commentIdentifierString)) { | ||
return comment.id; | ||
} | ||
} | ||
return undefined; | ||
}); | ||
} | ||
function run(inputs) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const netlifyAuthToken = process.env.NETLIFY_AUTH_TOKEN; | ||
|
@@ -41886,15 +41906,14 @@ function run() { | |
process.stdout.write('Netlify credentials not provided, not deployable'); | ||
return; | ||
} | ||
const dir = core.getInput('publish-dir', { required: true }); | ||
const deployMessage = core.getInput('deploy-message') || undefined; | ||
const productionBranch = core.getInput('production-branch'); | ||
// Default: true | ||
const enablePullRequestComment = (core.getInput('enable-pull-request-comment') || 'true') === 'true'; | ||
// Default: true | ||
const enableCommitComment = (core.getInput('enable-commit-comment') || 'true') === 'true'; | ||
// NOTE: if production-branch is not specified, it is "", so isDraft is always true | ||
const isDraft = github_1.context.ref !== `refs/heads/${productionBranch}`; | ||
const dir = inputs.publishDir(); | ||
const deployMessage = inputs.deployMessage(); | ||
const productionBranch = inputs.productionBranch(); | ||
const enablePullRequestComment = inputs.enablePullRequestComment(); | ||
const enableCommitComment = inputs.enableCommitComment(); | ||
const overwritesPullRequestComment = inputs.overwritesPullRequestComment(); | ||
const isDraft = productionBranch === undefined || | ||
github_1.context.ref !== `refs/heads/${productionBranch}`; | ||
// Create Netlify API client | ||
const netlifyClient = new netlify_1.default(netlifyAuthToken); | ||
// Resolve publish directory | ||
|
@@ -41913,8 +41932,9 @@ function run() { | |
// Set the deploy URL to outputs for GitHub Actions | ||
core.setOutput('deploy-url', isDraft ? deploy.deploy.deploy_ssl_url : deploy.deploy.ssl_url); | ||
// Get GitHub token | ||
const githubToken = core.getInput('github-token'); | ||
const githubToken = inputs.githubToken(); | ||
if (githubToken !== '') { | ||
const markdownComment = `${commentIdentifierString}\n${message}`; | ||
// Create GitHub client | ||
const githubClient = new github_1.GitHub(githubToken); | ||
if (enableCommitComment) { | ||
|
@@ -41923,7 +41943,7 @@ function run() { | |
repo: github_1.context.repo.repo, | ||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
commit_sha: github_1.context.sha, | ||
body: message | ||
body: markdownComment | ||
}; | ||
// TODO: Remove try | ||
// NOTE: try-catch is experimentally used because commit message may not be done in some conditions. | ||
|
@@ -41938,13 +41958,30 @@ function run() { | |
} | ||
// If it is a pull request and enable comment on pull request | ||
if (github_1.context.issue.number !== undefined && enablePullRequestComment) { | ||
let commentId = undefined; | ||
if (overwritesPullRequestComment) { | ||
// Find issue comment | ||
commentId = yield findIssueComment(githubClient); | ||
} | ||
// NOTE: if not overwrite, commentId is always undefined | ||
if (commentId !== undefined) { | ||
// Update comment of the deploy URL | ||
yield githubClient.issues.updateComment({ | ||
owner: github_1.context.issue.owner, | ||
repo: github_1.context.issue.repo, | ||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
comment_id: commentId, | ||
body: markdownComment | ||
}); | ||
return; | ||
} | ||
// Comment the deploy URL | ||
yield githubClient.issues.createComment({ | ||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
issue_number: github_1.context.issue.number, | ||
owner: github_1.context.repo.owner, | ||
repo: github_1.context.repo.repo, | ||
body: message | ||
body: markdownComment | ||
}); | ||
} | ||
} | ||
|
@@ -41954,7 +41991,7 @@ function run() { | |
} | ||
}); | ||
} | ||
run(); | ||
run(inputs_1.defaultInputs); | ||
|
||
|
||
/***/ }), | ||
|
@@ -75483,7 +75520,7 @@ module.exports = setup; | |
/* 487 */ | ||
/***/ (function(module) { | ||
|
||
module.exports = {"_from":"@typescript-eslint/[email protected]","_id":"@typescript-eslint/[email protected]","_inBundle":false,"_integrity":"sha512-vxW149bXFXXuBrAak0eKHOzbcu9cvi6iNcJDzEtOkRwGHxJG15chiAQAwhLOsk+86p9GTr/TziYvw+H9kMaIgA==","_location":"/@typescript-eslint/typescript-estree","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"@typescript-eslint/[email protected]","name":"@typescript-eslint/typescript-estree","escapedName":"@typescript-eslint%2ftypescript-estree","scope":"@typescript-eslint","rawSpec":"2.31.0","saveSpec":null,"fetchSpec":"2.31.0"},"_requiredBy":["/@typescript-eslint/experimental-utils","/@typescript-eslint/parser","/detective-typescript"],"_resolved":"https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.31.0.tgz","_shasum":"ac536c2d46672aa1f27ba0ec2140d53670635cfd","_spec":"@typescript-eslint/[email protected]","_where":"/Users/ryo/dev/actions/actions-netlify/node_modules/@typescript-eslint/parser","bugs":{"url":"https://github.com/typescript-eslint/typescript-eslint/issues"},"bundleDependencies":false,"dependencies":{"debug":"^4.1.1","eslint-visitor-keys":"^1.1.0","glob":"^7.1.6","is-glob":"^4.0.1","lodash":"^4.17.15","semver":"^6.3.0","tsutils":"^3.17.1"},"deprecated":false,"description":"A parser that converts TypeScript source code into an ESTree compatible form","devDependencies":{"@babel/code-frame":"^7.8.3","@babel/parser":"^7.8.3","@babel/types":"^7.8.3","@types/babel__code-frame":"^7.0.1","@types/debug":"^4.1.5","@types/glob":"^7.1.1","@types/is-glob":"^4.0.1","@types/lodash":"^4.14.149","@types/semver":"^6.2.0","@types/tmp":"^0.1.0","@typescript-eslint/shared-fixtures":"2.31.0","tmp":"^0.1.0","typescript":"*"},"engines":{"node":"^8.10.0 || ^10.13.0 || >=11.10.1"},"files":["dist","README.md","LICENSE"],"funding":{"type":"opencollective","url":"https://opencollective.com/typescript-eslint"},"gitHead":"176054c2171b682217d6855208e50b15e1712675","homepage":"https://github.com/typescript-eslint/typescript-eslint#readme","keywords":["ast","estree","ecmascript","javascript","typescript","parser","syntax"],"license":"BSD-2-Clause","main":"dist/parser.js","name":"@typescript-eslint/typescript-estree","peerDependenciesMeta":{"typescript":{"optional":true}},"repository":{"type":"git","url":"git+https://github.com/typescript-eslint/typescript-eslint.git","directory":"packages/typescript-estree"},"scripts":{"build":"tsc -b tsconfig.build.json","clean":"tsc -b tsconfig.build.json --clean","format":"prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore","lint":"eslint . --ext .js,.ts --ignore-path='../../.eslintignore'","test":"jest --coverage","typecheck":"tsc -p tsconfig.json --noEmit"},"types":"dist/parser.d.ts","version":"2.31.0"}; | ||
module.exports = {"name":"@typescript-eslint/typescript-estree","version":"2.31.0","description":"A parser that converts TypeScript source code into an ESTree compatible form","main":"dist/parser.js","types":"dist/parser.d.ts","files":["dist","README.md","LICENSE"],"engines":{"node":"^8.10.0 || ^10.13.0 || >=11.10.1"},"repository":{"type":"git","url":"https://github.com/typescript-eslint/typescript-eslint.git","directory":"packages/typescript-estree"},"bugs":{"url":"https://github.com/typescript-eslint/typescript-eslint/issues"},"license":"BSD-2-Clause","keywords":["ast","estree","ecmascript","javascript","typescript","parser","syntax"],"scripts":{"build":"tsc -b tsconfig.build.json","clean":"tsc -b tsconfig.build.json --clean","format":"prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore","lint":"eslint . --ext .js,.ts --ignore-path='../../.eslintignore'","test":"jest --coverage","typecheck":"tsc -p tsconfig.json --noEmit"},"dependencies":{"debug":"^4.1.1","eslint-visitor-keys":"^1.1.0","glob":"^7.1.6","is-glob":"^4.0.1","lodash":"^4.17.15","semver":"^6.3.0","tsutils":"^3.17.1"},"devDependencies":{"@babel/code-frame":"^7.8.3","@babel/parser":"^7.8.3","@babel/types":"^7.8.3","@types/babel__code-frame":"^7.0.1","@types/debug":"^4.1.5","@types/glob":"^7.1.1","@types/is-glob":"^4.0.1","@types/lodash":"^4.14.149","@types/semver":"^6.2.0","@types/tmp":"^0.1.0","@typescript-eslint/shared-fixtures":"2.31.0","tmp":"^0.1.0","typescript":"*"},"peerDependenciesMeta":{"typescript":{"optional":true}},"funding":{"type":"opencollective","url":"https://opencollective.com/typescript-eslint"},"gitHead":"176054c2171b682217d6855208e50b15e1712675","_resolved":"https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.31.0.tgz","_integrity":"sha512-vxW149bXFXXuBrAak0eKHOzbcu9cvi6iNcJDzEtOkRwGHxJG15chiAQAwhLOsk+86p9GTr/TziYvw+H9kMaIgA==","_from":"@typescript-eslint/[email protected]"}; | ||
|
||
/***/ }), | ||
/* 488 */ | ||
|
@@ -245551,7 +245588,49 @@ exports.ArraySet = ArraySet; | |
|
||
/***/ }), | ||
/* 839 */, | ||
/* 840 */, | ||
/* 840 */ | ||
/***/ (function(__unusedmodule, exports, __webpack_require__) { | ||
|
||
"use strict"; | ||
|
||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core = __importStar(__webpack_require__(470)); | ||
exports.defaultInputs = { | ||
publishDir() { | ||
return core.getInput('publish-dir', { required: true }); | ||
}, | ||
deployMessage() { | ||
return core.getInput('deploy-message') || undefined; | ||
}, | ||
productionBranch() { | ||
return core.getInput('production-branch') || undefined; | ||
}, | ||
enablePullRequestComment() { | ||
// Default: true | ||
return (core.getInput('enable-pull-request-comment') || 'true') === 'true'; | ||
}, | ||
enableCommitComment() { | ||
// Default: true | ||
return (core.getInput('enable-commit-comment') || 'true') === 'true'; | ||
}, | ||
githubToken() { | ||
return core.getInput('github-token'); | ||
}, | ||
overwritesPullRequestComment() { | ||
// Default: true | ||
return ((core.getInput('overwrites-pull-request-comment') || 'true') === 'true'); | ||
} | ||
}; | ||
|
||
|
||
/***/ }), | ||
/* 841 */, | ||
/* 842 */ | ||
/***/ (function(__unusedmodule, exports, __webpack_require__) { | ||
|
Oops, something went wrong.
c6e2a32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://nwtgck-actions-netlify.netlify.app as production
🚀 Deployed on https://5eb776ef1842f53a4e0a5e69--nwtgck-actions-netlify.netlify.app