Skip to content

Commit

Permalink
Merge pull request #8 from joshjohanning/6-customize-the-successful-a…
Browse files Browse the repository at this point in the history
…pproval-message

Customize the successful approval message
  • Loading branch information
joshjohanning authored Sep 15, 2022
2 parents 2a16da0 + 92a9772 commit 31094fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ 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
default: ":tada: You were able to run the workflow because someone left an approval in the comments!! :tada:"

outputs:
approved:
Expand Down Expand Up @@ -77,15 +85,15 @@ 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:
token: ${{ steps.get_installation_token.outputs.token }}
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' }}
Expand Down

0 comments on commit 31094fe

Please sign in to comment.