From be02c76192cdcb684b4ed10e2fb6ca8a164deef1 Mon Sep 17 00:00:00 2001 From: Josh Johanning Date: Thu, 15 Sep 2022 15:58:21 -0500 Subject: [PATCH 1/3] customizing approval comments #6 --- action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index bf62d5c..c52ca31 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,10 @@ inputs: description: "Fail the action (i.e. show the action run as red) if the command is not found in the comments from someone in the approver team" required: true default: 'false' + successful-approval-comment: + description: "Comment to post if there is an approval is found" + required: true + default: ":tada: You were able to run the workflow because someone left an approval in the comments!! :tada:" outputs: approved: @@ -85,7 +89,7 @@ runs: issue-number: ${{ github.event.issue.number }} body: | Hey, @${{ github.event.comment.user.login }}! - :tada: You were able to run the migration because someone approved!! :tada: + ${{ inputs.successful-approval-comment }} # if specified, exit with an error if approval is not found - if: ${{ inputs.fail-if-approval-not-found == 'true' && steps.check-approval.outputs.approved == 'false' }} From 353f7bc4716aa648afe840c75c7b61a50b694dde Mon Sep 17 00:00:00 2001 From: Josh Johanning Date: Thu, 15 Sep 2022 16:04:25 -0500 Subject: [PATCH 2/3] adding boolean for posting approval comment #6 --- action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c52ca31..b2d315a 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,10 @@ inputs: description: "Fail the action (i.e. show the action run as red) if the command is not found in the comments from someone in the approver team" required: true default: 'false' + post-successful-approval-comment: + description: "Boolean whether to post successful approval comment" + required: true + default: 'true' successful-approval-comment: description: "Comment to post if there is an approval is found" required: true @@ -81,7 +85,7 @@ runs: :cry: No one approved your run yet! Have someone from the @${{ github.repository_owner }}/${{ inputs.team-name }} team run `/approve` and then try your command again :no_entry_sign: :no_entry: Marking the workflow run as failed - - if: ${{ steps.check-approval.outputs.approved == 'true' }} + - if: ${{ steps.check-approval.outputs.approved == 'true' && inputs.post-successful-approval-comment == 'true' }} name: Create completed comment uses: peter-evans/create-or-update-comment@v1 with: From 92a9772e471c48f64110103f00cd71b77e1f413d Mon Sep 17 00:00:00 2001 From: Josh Johanning Date: Thu, 15 Sep 2022 16:12:15 -0500 Subject: [PATCH 3/3] updating readme with approval comment options #6 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 45bca36..bac9c17 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ See the following guide on this action: https://josh-ops.com/posts/github-approv app-private-key: ${{ secrets.PRIVATE_KEY }} # Private key for the GitHub App that is installed on the repo; e.g.: ${{ secrets.PRIVATE_KEY }} team-name: approver-team # The name of the team in GitHub to check for the approval command; e.g.: approver-team fail-if-approval-not-found: false # Fail the action (show the action run as red) if the command is not found in the comments from someone in the approver team" + post-successful-approval-comment: true # Boolean whether to post successful approval comment + successful-approval-comment: ':tada: You were able to run the workflow because someone left an approval in the comments!! :tada:' # Comment to post if there is an approval is found ``` ## Prerequisites