Re-write configure action in JS
This commit is contained in:
@@ -9,12 +9,5 @@ inputs:
|
|||||||
service-account-token:
|
service-account-token:
|
||||||
description: Your 1Password service account token
|
description: Your 1Password service account token
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: "node20"
|
||||||
steps:
|
main: "dist/index.js"
|
||||||
- shell: bash
|
|
||||||
env:
|
|
||||||
INPUT_CONNECT_HOST: ${{ inputs.connect-host }}
|
|
||||||
INPUT_CONNECT_TOKEN: ${{ inputs.connect-token }}
|
|
||||||
INPUT_SERVICE_ACCOUNT_TOKEN: ${{ inputs.service-account-token }}
|
|
||||||
run: |
|
|
||||||
${{ github.action_path }}/entrypoint.sh
|
|
||||||
|
|||||||
27586
configure/dist/index.js
vendored
Normal file
27586
configure/dist/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
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
|
|
||||||
|
|
||||||
OP_SERVICE_ACCOUNT_TOKEN="${INPUT_SERVICE_ACCOUNT_TOKEN:-$OP_SERVICE_ACCOUNT_TOKEN}"
|
|
||||||
if [ -n "$OP_SERVICE_ACCOUNT_TOKEN" ]; then
|
|
||||||
echo "OP_SERVICE_ACCOUNT_TOKEN=$OP_SERVICE_ACCOUNT_TOKEN" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
25
configure/index.js
Normal file
25
configure/index.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
const core = require("@actions/core");
|
||||||
|
|
||||||
|
const configure = () => {
|
||||||
|
const OP_CONNECT_HOST =
|
||||||
|
process.env.INPUT_CONNECT_HOST || process.env.OP_CONNECT_HOST;
|
||||||
|
const OP_CONNECT_TOKEN =
|
||||||
|
process.env.INPUT_CONNECT_TOKEN || process.env.CONNECT_TOKEN;
|
||||||
|
const OP_SERVICE_ACCOUNT_TOKEN =
|
||||||
|
process.env.INPUT_SERVICE_ACCOUNT_TOKEN ||
|
||||||
|
process.env.SERVICE_ACCOUNT_TOKEN;
|
||||||
|
|
||||||
|
if (OP_CONNECT_HOST) {
|
||||||
|
core.exportVariable("OP_CONNECT_HOST", OP_CONNECT_HOST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OP_CONNECT_TOKEN) {
|
||||||
|
core.exportVariable("OP_CONNECT_TOKEN", OP_CONNECT_TOKEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OP_SERVICE_ACCOUNT_TOKEN) {
|
||||||
|
core.exportVariable("OP_SERVICE_ACCOUNT_TOKEN", OP_SERVICE_ACCOUNT_TOKEN);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
configure();
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build ./src/index.ts",
|
"build": "ncc build ./src/index.ts",
|
||||||
|
"build:configure": "ncc build ./configure/index.js -o ./configure/dist",
|
||||||
"format": "prettier --ignore-path ./config/.prettierignore",
|
"format": "prettier --ignore-path ./config/.prettierignore",
|
||||||
"format:check": "npm run format -- --check ./",
|
"format:check": "npm run format -- --check ./",
|
||||||
"format:write": "npm run format -- --write ./",
|
"format:write": "npm run format -- --write ./",
|
||||||
|
|||||||
Reference in New Issue
Block a user