Skip to content
name: Get Latest Deployed Versions from GitHub
on:
workflow_call:
inputs:
environment:
description: "Environment to get latest deployed versions for (e.g., staging, prod, yt01)"
required: true
type: string
secrets:
GITHUB_TOKEN:

Check failure on line 11 in .github/workflows/workflow-get-latest-deployed-versions-from-github.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/workflow-get-latest-deployed-versions-from-github.yml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
required: true
outputs:
infra_version_sha:
description: "SHA of the latest deployed infrastructure version"
value: ${{ jobs.get-versions.outputs.infra_version_sha }}
apps_version_sha:
description: "SHA of the latest deployed applications version"
value: ${{ jobs.get-versions.outputs.apps_version_sha }}
jobs:
get-versions:
name: Get Latest Deployed Versions from GitHub Variables
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
infra_version_sha: ${{ steps.get-infra-sha.outputs.sha }}
apps_version_sha: ${{ steps.get-apps-sha.outputs.sha }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Latest Deployed Infra Version
id: get-infra-version
run: echo "version=$(gh variable get LATEST_DEPLOYED_INFRA_VERSION --repo ${{ github.repository }} --env ${{ inputs.environment }} --json value --jq .value || echo '')" >> $GITHUB_OUTPUT
- name: Get Infra SHA
id: get-infra-sha
if: steps.get-infra-version.outputs.version != ''
run: |
SHA=$(git rev-list -n 1 ${{ steps.get-infra-version.outputs.version }})
echo "sha=$SHA" >> $GITHUB_OUTPUT
- name: Get Latest Deployed Apps Version
id: get-apps-version
run: echo "version=$(gh variable get LATEST_DEPLOYED_APPS_VERSION --repo ${{ github.repository }} --env ${{ inputs.environment }} --json value --jq .value || echo '')" >> $GITHUB_OUTPUT
- name: Get Apps SHA
id: get-apps-sha
if: steps.get-apps-version.outputs.version != ''
run: |
SHA=$(git rev-list -n 1 ${{ steps.get-apps-version.outputs.version }})
echo "sha=$SHA" >> $GITHUB_OUTPUT