Add subaction to persist Connect details
This commit is contained in:
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
@@ -12,11 +12,14 @@ jobs:
|
||||
run: |
|
||||
echo "$OP_CONNECT_CREDENTIALS" > 1password-credentials.json
|
||||
docker-compose -f tests/fixtures/docker-compose.yml up -d && sleep 10
|
||||
- name: Configure 1Password Connect
|
||||
uses: ./configure
|
||||
with:
|
||||
connect-host: http://localhost:8080
|
||||
connect-token: ${{ secrets.OP_CONNECT_TOKEN }}
|
||||
- name: Load secrets
|
||||
uses: ./
|
||||
env:
|
||||
OP_CONNECT_HOST: http://localhost:8080
|
||||
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}
|
||||
SECRET: op://v5pz6venw4roosmkzdq2nhpv6u/hrgkzhrlvscomepxlgafb2m3ca/password
|
||||
SECRET_IN_SECTION: op://v5pz6venw4roosmkzdq2nhpv6u/hrgkzhrlvscomepxlgafb2m3ca/test-section/password
|
||||
MULTILINE_SECRET: op://v5pz6venw4roosmkzdq2nhpv6u/ghtz3jvcc6dqmzc53d3r3eskge/notesPlain
|
||||
@@ -35,8 +38,6 @@ jobs:
|
||||
- name: Load secret again
|
||||
uses: ./
|
||||
env:
|
||||
OP_CONNECT_HOST: http://localhost:8080
|
||||
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}
|
||||
SECRET: op://v5pz6venw4roosmkzdq2nhpv6u/hrgkzhrlvscomepxlgafb2m3ca/password
|
||||
SECRET_IN_SECTION: op://v5pz6venw4roosmkzdq2nhpv6u/hrgkzhrlvscomepxlgafb2m3ca/test-section/password
|
||||
MULTILINE_SECRET: op://v5pz6venw4roosmkzdq2nhpv6u/ghtz3jvcc6dqmzc53d3r3eskge/notesPlain
|
||||
|
||||
14
configure/action.yml
Normal file
14
configure/action.yml
Normal 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
15
configure/entrypoint.sh
Executable 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
|
||||
Reference in New Issue
Block a user