Add subaction to persist Connect details

This commit is contained in:
Floris van der Grinten
2021-05-19 15:52:00 +02:00
parent 5b8ac70e92
commit 7bbc7abc2f
3 changed files with 34 additions and 4 deletions

14
configure/action.yml Normal file
View File

@@ -0,0 +1,14 @@
name: configure-action
inputs:
connect-host:
description: Your 1Password Connect instance URL
connect-token:
description: Token to authenticate to your 1Password Connect instance
runs:
using: composite
steps:
- run: |
export INPUT_CONNECT_HOST=${{ inputs.connect-host }}
export INPUT_CONNECT_TOKEN=${{ inputs.connect-token }}
${{ github.action_path }}/entrypoint.sh
shell: bash

15
configure/entrypoint.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -e
# Capture Connect configuration in $GITHUB_ENV, giving (optional) inputs
# precendence over OP_CONNECT_* environment variables.
OP_CONNECT_HOST=${INPUT_CONNECT_HOST:-$OP_CONNECT_HOST}
if [ -n "$OP_CONNECT_HOST" ]; then
echo "OP_CONNECT_HOST=$OP_CONNECT_HOST" >> $GITHUB_ENV
fi
OP_CONNECT_TOKEN=${INPUT_CONNECT_TOKEN:-$OP_CONNECT_TOKEN}
if [ -n "$OP_CONNECT_TOKEN" ]; then
echo "OP_CONNECT_TOKEN=$OP_CONNECT_TOKEN" >> $GITHUB_ENV
fi