From 7eac11de7f30536f8b11cfc1d6aec5e45390ac30 Mon Sep 17 00:00:00 2001 From: Schitiz Sharma Date: Thu, 3 Jul 2025 19:50:14 +0530 Subject: [PATCH] chore: use inputs context instead of github.event.inputs for reusable workflow compatibility Replace all references to github.event.inputs.environment and github.event.inputs.version with inputs.environment and inputs.version to ensure the workflow functions correctly when called as a reusable workflow via workflow_call trigger. This change ensures the build-and-release.yml workflow can be successfully called from release-approval.yml without build failures due to empty environment variables. References: - https://docs.github.com/en/actions/reference/accessing-contextual-information-about-workflow-runs#example-usage-of-the-inputs-context-in-a-reusable-workflow - https://docs.github.com/en/actions/reference/events-that-trigger-workflows#providing-inputs --- .github/workflows/build-and-release.yml | 10 +++++----- .github/workflows/draft-release-and-changelog.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index a4a4b646c..6fd1749b4 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -31,22 +31,22 @@ on: jobs: build_and_publish_frontend: - name: Build and publish frontend image for ${{ github.event.inputs.environment }} - environment: ${{ github.event.inputs.environment }} + name: Build and publish frontend image for ${{ inputs.environment }} + environment: ${{ inputs.environment }} runs-on: ubuntu-latest env: DOCKER_LOGIN: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} DOCKER_REPO: ${{ secrets.DOCKER_REPO || 'olakego' }} DOCKER_REPO_WORKER: ${{ secrets.DOCKER_REPO_WORKER || 'olakego' }} - ENVIRONMENT: ${{ github.event.inputs.environment }} - VERSION: ${{ github.event.inputs.version }} + ENVIRONMENT: ${{ inputs.environment }} + VERSION: ${{ inputs.version }} steps: - name: Checkout code uses: actions/checkout@v3 with: - ref: ${{ github.event.inputs.environment == 'master' && 'master' || (github.event.inputs.environment == 'staging' && 'staging' || github.event.inputs.environment == 'dev' && 'ci/workerReleaseIssues' || 'develop') }} + ref: ${{ inputs.environment == 'master' && 'master' || (inputs.environment == 'staging' && 'staging' || inputs.environment == 'dev' && 'ci/workerReleaseIssues' || 'develop') }} - name: Set up Node.js uses: actions/setup-node@v3 diff --git a/.github/workflows/draft-release-and-changelog.yml b/.github/workflows/draft-release-and-changelog.yml index c4bf4731f..684c67e86 100644 --- a/.github/workflows/draft-release-and-changelog.yml +++ b/.github/workflows/draft-release-and-changelog.yml @@ -29,7 +29,7 @@ jobs: id: generate-next-version run: | if [ -z "$LATEST_TAG" ]; then - next_version="v0.1.0" + next_version="v0.0.5" else # Remove 'v' prefix and split version into array version=${LATEST_TAG#v}