Skip to content

add option to disable comments #273

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion bin/action.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down Expand Up @@ -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);
Expand Down