Skip to content

Commit

Permalink
feat: add outcome input
Browse files Browse the repository at this point in the history
  • Loading branch information
mbystedt committed Dec 31, 2024
1 parent 248e8e4 commit 73de391
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Broker Action End V2
# Broker Action End V3

This action ends an action, so progress with an intention can be tracked.

Expand All @@ -12,14 +12,18 @@ Please refer to the [NR Broker Repository](https://github.com/bcgov-nr/nr-broker

<!-- start usage -->
```yaml
- uses: bcgov-nr/action-broker-action-end@v2
- uses: bcgov-nr/action-broker-action-end@v3
with:
# The token of the action to start
action_token: ''

# The broker url.
# Default: 'https://broker.io.nrs.gov.bc.ca'
broker_url: ''

# The outcome of the action. Must be 'success', 'failure' or 'unknown'
# Default: 'success'
outcome: 'success'
```
<!-- end usage -->
Expand Down
2 changes: 1 addition & 1 deletion action-end.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo "===> Action end"

# Use saved action token to start it
RESPONSE=$(curl -s -X POST $BROKER_URL/v1/intention/action/end -H 'X-Broker-Token: '"$ACTION_TOKEN"'')
RESPONSE=$(curl -s -X POST -G $BROKER_URL/v1/intention/action/end --data-urlencode 'outcome='"$OUTCOME"'' -H 'X-Broker-Token: '"$ACTION_TOKEN"'')
code=$?

if [ "$code" != "0" ]; then
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ inputs:
broker_url:
default: https://broker.io.nrs.gov.bc.ca
description: The broker url.
outcome:
default: success
description: The outcome of the action. Must be 'success', 'failure' or 'unknown'

runs:
using: "composite"
Expand All @@ -22,4 +25,5 @@ runs:
env:
ACTION_TOKEN: ${{ inputs.action_token }}
BROKER_URL: ${{ inputs.broker_url }}
OUTCOME: ${{ inputs.outcome }}
run: action-end.sh

0 comments on commit 73de391

Please sign in to comment.