diff --git a/action.yml b/action.yml index 6566c985..95823499 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,10 @@ inputs: description: "How long should a preview live? See the preview channels docs for options" default: "7d" required: false + addComment: + description: "Add comment on pull request with preview URL" + default: "true" + required: false projectId: description: "The project to deploy to. If you leave this blank, make sure you check in diff --git a/bin/action.min.js b/bin/action.min.js index 1be0a92e..08802f13 100644 --- a/bin/action.min.js +++ b/bin/action.min.js @@ -11415,6 +11415,7 @@ async function postChannelSuccessComment(github, context, result, commit) { const expires = core.getInput("expires"); const projectId = core.getInput("projectId"); +const addComment = core.getInput("addComment") === "true"; const googleApplicationCredentials = core.getInput("firebaseServiceAccount", { required: true }); @@ -11510,7 +11511,7 @@ async function run() { core.setOutput("details_url", urls[0]); const urlsListMarkdown = urls.length === 1 ? `[${urls[0]}](${urls[0]})` : urls.map(url => `- [${url}](${url})`).join("\n"); - if (token && isPullRequest && !!octokit) { + if (token && isPullRequest && !!octokit && addComment) { var _context$payload$pull; const commitId = (_context$payload$pull = github.context.payload.pull_request) == null ? void 0 : _context$payload$pull.head.sha.substring(0, 7); diff --git a/package-lock.json b/package-lock.json index 92cfabde..6e7e8a6a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,12 @@ { "name": "firebase-hosting-preview-action", + "version": "0.7.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "firebase-hosting-preview-action", + "version": "0.7.0", "devDependencies": { "@actions/core": "^1.2.6", "@actions/exec": "^1.0.3", @@ -25,8 +27,7 @@ "ts-jest": "^26.4.1", "ts-node": "^9.0.0", "typescript": "^4.0.3" - }, - "version": "0.7.0" + } }, "node_modules/@actions/core": { "version": "1.2.6", @@ -24319,6 +24320,5 @@ "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true } - }, - "version": "0.7.0" + } } diff --git a/src/index.ts b/src/index.ts index ef90f2db..f26113d0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -40,6 +40,7 @@ import { // Inputs defined in action.yml const expires = getInput("expires"); const projectId = getInput("projectId"); +const addComment = getInput("addComment") === "true"; const googleApplicationCredentials = getInput("firebaseServiceAccount", { required: true, }); @@ -139,7 +140,7 @@ async function run() { ? `[${urls[0]}](${urls[0]})` : urls.map((url) => `- [${url}](${url})`).join("\n"); - if (token && isPullRequest && !!octokit) { + if (token && isPullRequest && !!octokit && addComment) { const commitId = context.payload.pull_request?.head.sha.substring(0, 7); await postChannelSuccessComment(octokit, context, deployment, commitId);