Skip to content
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

Allow user to specify activation string #10

Merged
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

This GitHub Action lets a prospective contributor assign themselves to an issue, and optionally leaves a comment on the issue.

- `message`<br />The message to display to the user once they have assigned themselves to an issue.
- `trigger`<br />The string that take action will search for in the comment body to activate the action.

## Setup

Expand All @@ -27,4 +29,5 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
with:
message: Thanks for taking this issue! Let us know if you have any questions!
trigger: .take
```
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ inputs:
description: 'Message to contributors if issue is already assigned'
required: false
default: 'The issue you are trying to assign to yourself is already assigned.'
trigger:
description: 'The string that triggers the action'
required: false
default: '.take'

runs:
using: "composite"
Expand All @@ -27,7 +31,7 @@ runs:
ISSUE_JSON="$(jq '.issue' $GITHUB_EVENT_PATH)"
ISSUE_CURRENTLY_ASSIGNED=`echo $ISSUE_JSON | jq '.assignees | length == 0'`

if [[ $BODY == *".take"* ]]; then
if [[ $BODY == *"$INPUT_TRIGGER"* ]]; then
if [[ "$ISSUE_CURRENTLY_ASSIGNED" == true ]]; then
echo "Is issue currently assigned: $ISSUE_CURRENTLY_ASSIGNED"
echo "Assigning issue $ISSUE_NUMBER to $LOGIN"
Expand All @@ -48,4 +52,5 @@ runs:
shell: bash
env:
INPUT_MESSAGE: "${{ inputs.message }}"
INPUT_TRIGGER: "${{ inputs.trigger }}"
ISSUE_CURRENTLY_ASSIGNED_MESSAGE: "${{ inputs.issueCurrentlyAssignedMessage }}"