Skip to content

Test running GitHub Action after Circle CI checks #125

Test running GitHub Action after Circle CI checks

Test running GitHub Action after Circle CI checks #125

name: Test running GitHub Action after Circle CI checks
on:
check_run:
types:
- completed
jobs:
lookup:
name: Lookup git tag in Circle CI Workflow
runs-on: ubuntu-latest
permissions: {}
outputs:
TAG: ${{ steps.determine.outputs.tag }}
if: |
github.event.check_run.conclusion == 'success'
&& github.event.check_run.app.client_id == 'Iv1.44befee49e3e76a4'
&& github.event.check_run.name == 'test_and_deploy_tag'
env:
CIRCLECI_EXTERNAL_ID: ${{ github.event.check_run.external_id }}
steps:
- id: determine
run: |
echo ${CIRCLECI_EXTERNAL_ID}
CIRCLECI_WORKFLOW_ID=$(echo "${CIRCLECI_EXTERNAL_ID}" | jq -r '."workflow-id"')
CIRCLECI_WORKFLOW_DATA=$(curl "https://circleci.com/api/v2/workflow/${CIRCLECI_WORKFLOW_ID}")
CIRCLECI_PIPELINE_ID=$(echo "${CIRCLECI_WORKFLOW_DATA}" | jq -r '.pipeline_id')
CIRCLECI_PIPELINE_DATA=$(curl "https://circleci.com/api/v2/pipeline/${CIRCLECI_PIPELINE_ID}")
TAG=$(echo "${CIRCLECI_PIPELINE_DATA}" | jq -r '.vcs.tag')
# check_run
if [[ "${TAG}" != "" ]]; then
echo "tag=${TAG}" >> $GITHUB_OUTPUT
else
echo "Cannot determine tag"
exit 1
fi