Files
concrete/.github/workflows/start_slab.yml

50 lines
1.4 KiB
YAML

# Start job on Slab CI bot given by input command.
name: Start AWS job
on:
workflow_call:
inputs:
command:
required: true
type: string
workflow_dispatch:
inputs:
command:
required: true
type: string
env:
GIT_REF: ${{ github.head_ref }}
jobs:
sl:
runs-on: ubuntu-latest
steps:
- name: Get git ref
# github.head_ref is only available from a Pull Request
if: env.GIT_REF == ''
run: |
echo "GIT_REF=${{ github.ref }}" >> $GITHUB_ENV
- name: Checkout Slab repo
uses: actions/checkout@v3
with:
repository: zama-ai/slab
path: slab
token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
- name: Start AWS job in Slab
shell: bash
# TODO: step result must be correlated to HTTP return code.
run: |
echo -n '{"command": "${{ inputs.command }}", "git_ref": "${{ env.GIT_REF }}", "sha": "${{ github.sha }}"}' > command.json
SIGNATURE="$(slab/scripts/hmac_calculator.sh command.json '${{ secrets.JOB_SECRET }}')"
curl -v -k \
--fail-with-body \
-H "Content-Type: application/json" \
-H "X-Slab-Repository: ${{ github.repository }}" \
-H "X-Slab-Command: start_aws" \
-H "X-Hub-Signature-256: sha256=${SIGNATURE}" \
-d @command.json \
${{ secrets.SLAB_URL }}