Skip to content

Commit

Permalink
Plumb the invite code through from the caller (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor authored Mar 28, 2022
1 parent a30653f commit 1548482
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions setup-chainctl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ and authenticates with it using identity tokens.
# (for now).
# Required.
audience: oscar-the-grouch
# invite-code is an invitation code that may be used to have this workload
# register itself with the Chainguard API the first time it executes.
# Optional.
invite-code: ${{ secrets.CHAINGUARD_INVITE_CODE }}
```
## Scenarios
Expand All @@ -30,4 +34,5 @@ steps:
with:
environment: big-bird
audience: elmo
invite-code: ${{ secrets.CHAINGUARD_INVITE_CODE }}
```
9 changes: 8 additions & 1 deletion setup-chainctl/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ inputs:
and has no default (for now).
required: true

invite-code:
description: |
Optionally specifies an invite code that allows this workflow
register itself when run for the first time.
required: false


runs:
using: "composite"

Expand All @@ -34,7 +41,7 @@ runs:
- name: Authenticate with Chainguard
shell: bash
env:
CHAINGUARD_INVITE_CODE: ${{ secrets.CHAINGUARD_INVITE_CODE }}
CHAINGUARD_INVITE_CODE: ${{ inputs.invite-code }}
run: |
AUDIENCE="${{ inputs.audience }}"
IDTOKEN=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${AUDIENCE}" | jq -r '.value')
Expand Down

0 comments on commit 1548482

Please sign in to comment.