Skip to content

Commit

Permalink
feat: pre-req check
Browse files Browse the repository at this point in the history
  • Loading branch information
joshjohanning committed Dec 3, 2023
1 parent 6a752f0 commit b0477ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
## Prerequisites
### Team and Authentication
1. Create a GitHub team and add at least one member
2. Authentication options:
- GitHub App
Expand All @@ -62,6 +64,13 @@ Notes:
- A Personal Access Token (PAT) is not used since we want the comment to show as from a bot
- The `github.token` is not used since the token can't provide hyperlinks for @ mentions since it doesn't have the scope for org teams, only repository data

### Runner Software Requirements

Required software installed on runner:

- [`gh` (GitHub CLI)](https://cli.github.com/)
- [`jq`](https://jqlang.github.io/jq/download/)

## Breaking Changes

### v1 to v2
Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ runs:
shell: bash
run: |
# "checking for a ${{ inputs.approve-command }} command in the comments from someone in the ${{ inputs.team-name}} team"
# prerequisite check
for cmd in gh jq; do
if ! command -v $cmd &> /dev/null; then
echo "::error title=${cmd} not installed::Could not find \`${cmd}\` on the runner"
exit 1
fi
done
# getting team membership"
echo "getting team membership for the team: @${{ github.repository_owner }}/${{ inputs.team-name }} ..."
users=$(gh api --paginate '${{ github.event.organization.url }}/teams/${{ inputs.team-name }}/members' --jq '.[].login')
Expand Down

0 comments on commit b0477ec

Please sign in to comment.