Skip to content

actions

actions #12

name: "Custom Actions Handler"
on:
repository_dispatch:
types:
- actions
workflow_dispatch:
inputs:
api_token:
description: "The API token of the sandbox account to Terraform apply to."
type: string
required: true
user_email:
description: "Email address to send invite to."
type: string
required: true
jobs:
handler:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.10.0"
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup OpsLevel CLI
uses: opslevel/actions/setup-cli@v1
- name: Mask inputs
run: |
OPSLEVEL_API_TOKEN=$(jq -r 'select(.client_payload.api_token or .inputs.api_token)' $GITHUB_EVENT_PATH)
SANDBOX_USER_EMAIL=$(jq -r 'select(.client_payload.user_email or .inputs.user_email)' $GITHUB_EVENT_PATH)
echo "::add-mask::$OPSLEVEL_API_TOKEN"
echo "::add-mask::$SANDBOX_USER_EMAIL"
echo "OPSLEVEL_API_TOKEN=$OPSLEVEL_API_TOKEN" >> $GITHUB_ENV
echo "SANDBOX_USER_EMAIL=$SANDBOX_USER_EMAIL" >> $GITHUB_ENV
- name: Apply Terraform
env:
OPSLEVEL_API_TOKEN: "${{ env.OPSLEVEL_API_TOKEN }}"
SANDBOX_USER_EMAIL: "${{ env.SANDBOX_USER_EMAIL }}"
run: |
task factory-reset -y
task apply-demo -- -auto-approve