Skip to content

Commit

Permalink
updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
joshjohanning committed Mar 7, 2023
1 parent a776b56 commit 216735f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
59 changes: 38 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,38 @@ See the following guide on this action: https://josh-ops.com/posts/github-approv
## Usage

```yml
# get the app's installation token
- uses: tibdex/github-app-token@v1
id: get_installation_token
with:
app_id: 170284
private_key: ${{ secrets.PRIVATE_KEY }}

- name: ApproveOps - Approvals in IssueOps
uses: joshjohanning/approveops@v1
id: check-approval
with:
token: ${{ steps.get_installation_token.outputs.token }} # use a github app token or a PAT
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
name: ApproveOps
on:
issue_comment:
types: [created]

env:
approver_team_name: 'approver-team'
approval_command: '/approve'

jobs:
approveops:
runs-on: ubuntu-latest
if: contains(github.event.comment.body, '/do-stuff')

steps:
# get the app's installation token
- uses: tibdex/github-app-token@v1
id: get_installation_token
with:
app_id: 170284
private_key: ${{ secrets.PRIVATE_KEY }}

- name: ApproveOps - Approvals in IssueOps
uses: joshjohanning/approveops@v2
id: check-approval
with:
token: ${{ steps.get_installation_token.outputs.token }} # use a github app token or a PAT
approve-command: '${{ env.approval_command }}' # Optional, defaults to '/approve', the command to look for in the comments
team-name: ${{ env.approver_team_name }} # The name of the team in GitHub to check for the approval command; e.g.: approver-team
fail-if-approval-not-found: false # Optional, defaults to true, 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 # Optional, defaults to true, 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:' # Optional, comment to post if an approval is found
```
## Prerequisites
Expand Down Expand Up @@ -56,13 +72,14 @@ Notes:

Extracting the logic for generating a GitHub App's installation token so that you can either use an alternative action or method to retrieve the token or to be able use a GitHub PAT instead.

Updated the following inputs:
Added/removed the following inputs:

| Input | Action | Required | Note |
|-------------------|---------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Input | Action | Required | Note |
|-------------------|---------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `token` | Added | Yes | GitHub App installation token or PAT that has access to read+write comments and list the org team's membership; ie `${{ steps.get_installation_token.outputs.token }}` |
| `app-id` | Removed | Yes | The app ID for a GitHub App ie `170284` |
| `app-private-key` | Removed | Yes | The private key for a GitHub App, ie: `${{ secrets.APP_PRIVATE_KEY }}` |
| `approve-command` | Added | No | Optional, defaults to `/approve`, the command to look for in the comments |
| `app-id` | Removed | Yes | The app ID for a GitHub App ie `170284` |
| `app-private-key` | Removed | Yes | The private key for a GitHub App, ie: `${{ secrets.APP_PRIVATE_KEY }}` |

Removed the following dependency:
- `tibdex/github-app-token@v1`
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inputs:
required: true
default: 'true'
successful-approval-comment:
description: "Comment to post if there is an approval is found"
description: "Comment to post if an approval is found"
required: true
default: ":tada: You were able to run the workflow because someone left an approval in the comments!! :tada:"

Expand Down

0 comments on commit 216735f

Please sign in to comment.