diff --git a/.github/workflows/build-downstream.yml b/.github/workflows/build-downstream.yml index 91f33499bd10..0545a7a705ae 100644 --- a/.github/workflows/build-downstream.yml +++ b/.github/workflows/build-downstream.yml @@ -74,7 +74,7 @@ jobs: git clone $GITHUB_PATH $OUTPUT_PATH --branch $BASE_BRANCH } - GH_REPO="${{ inputs.repo }}" + GH_REPO="${INPUTS_REPO}" if [ "$GH_REPO" == "docs-examples" ] && [ "$BASE_BRANCH" == "main" ]; then BASE_BRANCH="master" fi @@ -106,9 +106,11 @@ jobs: fi (current_dir=$(pwd) && cd $OUTPUT_PATH && zip -r "$current_dir/output.zip" .) + env: + INPUTS_REPO: ${{ inputs.repo }} - name: Upload built artifacts uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 with: name: artifact-${{ inputs.repo }} - path: output.zip \ No newline at end of file + path: output.zip diff --git a/.github/workflows/magic-modules.yml b/.github/workflows/magic-modules.yml index d92e666e2b60..41779b762b0d 100644 --- a/.github/workflows/magic-modules.yml +++ b/.github/workflows/magic-modules.yml @@ -20,9 +20,9 @@ jobs: cd repo git config user.name "modular-magician" git config user.email "magic-modules@google.com" - git fetch origin ${{ github.base_ref }} # Fetch the base branch - git merge --no-ff origin/${{ github.base_ref }} # Merge with the base branch - yamlfiles=$(git diff --name-only origin/${{ github.base_ref }} -- mmv1/products) # Compare with the base branch + git fetch origin ${GITHUB_BASE_REF} # Fetch the base branch + git merge --no-ff origin/${GITHUB_BASE_REF} # Merge with the base branch + yamlfiles=$(git diff --name-only origin/${GITHUB_BASE_REF} -- mmv1/products) # Compare with the base branch if [ ! -z "$yamlfiles" ]; then echo "yamlfiles=repo/${yamlfiles//$'\n'/ repo/}" >> $GITHUB_OUTPUT fi @@ -31,7 +31,9 @@ jobs: run: pip install yamllint - name: Lint YAML files if: ${{ !failure() && steps.pull_request.outputs.yamlfiles != '' }} - run: yamllint -c repo/.yamllint ${{steps.pull_request.outputs.yamlfiles}} + run: yamllint -c repo/.yamllint ${STEPS_PULL_REQUEST_OUTPUTS_YAMLFILES} + env: + STEPS_PULL_REQUEST_OUTPUTS_YAMLFILES: ${{steps.pull_request.outputs.yamlfiles}} rake-tests: runs-on: ubuntu-22.04 steps: @@ -46,8 +48,8 @@ jobs: cd repo git config user.name "modular-magician" git config user.email "magic-modules@google.com" - git fetch origin ${{ github.base_ref }} # Fetch the base branch - git merge --no-ff origin/${{ github.base_ref }} # Merge with the base branch + git fetch origin ${GITHUB_BASE_REF} # Fetch the base branch + git merge --no-ff origin/${GITHUB_BASE_REF} # Merge with the base branch - name: Set up Ruby uses: ruby/setup-ruby@036ef458ddccddb148a2b9fb67e95a22fdbf728b # v1.160.0 with: diff --git a/.github/workflows/test-tgc.yml b/.github/workflows/test-tgc.yml index 190bb6ae68c0..cda58d26bee0 100644 --- a/.github/workflows/test-tgc.yml +++ b/.github/workflows/test-tgc.yml @@ -46,12 +46,16 @@ jobs: run: | curl -X POST -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \ -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${{github.event.inputs.sha}}" \ + "https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${GITHUB_EVENT_INPUTS_SHA}" \ -d '{ - "context": "${{ github.event.inputs.repo }}${{ env.status_suffix }}", - "target_url": "${{ steps.get_job.outputs.url }}", + "context": "${GITHUB_EVENT_INPUTS_REPO}${{ env.status_suffix }}", + "target_url": "${STEPS_GET_JOB_OUTPUTS_URL}", "state": "pending" }' + env: + GITHUB_EVENT_INPUTS_SHA: ${{github.event.inputs.sha}} + GITHUB_EVENT_INPUTS_REPO: ${{ github.event.inputs.repo }} + STEPS_GET_JOB_OUTPUTS_URL: ${{ steps.get_job.outputs.url }} - name: Checkout Repository uses: actions/checkout@v4 with: @@ -84,9 +88,12 @@ jobs: - name: Build Terraform Google Conversion if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }} run: | - go mod edit -replace github.com/hashicorp/terraform-provider-google-beta=github.com/${{ github.event.inputs.owner }}/terraform-provider-google-beta@${{ github.event.inputs.branch }} + go mod edit -replace github.com/hashicorp/terraform-provider-google-beta=github.com/${GITHUB_EVENT_INPUTS_OWNER}/terraform-provider-google-beta@${GITHUB_EVENT_INPUTS_BRANCH} go mod tidy make build + env: + GITHUB_EVENT_INPUTS_OWNER: ${{ github.event.inputs.owner }} + GITHUB_EVENT_INPUTS_BRANCH: ${{ github.event.inputs.branch }} - name: Run Unit Tests if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }} run: | @@ -96,9 +103,14 @@ jobs: run: | curl -X POST -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \ -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${{github.event.inputs.sha}}" \ + "https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${GITHUB_EVENT_INPUTS_SHA}" \ -d '{ - "context": "${{ github.event.inputs.repo }}${{ env.status_suffix }}", - "target_url": "${{ steps.get_job.outputs.url }}", - "state": "${{ job.status }}" + "context": "${GITHUB_EVENT_INPUTS_REPO}${{ env.status_suffix }}", + "target_url": "${STEPS_GET_JOB_OUTPUTS_URL}", + "state": "${JOB_STATUS}" }' + env: + GITHUB_EVENT_INPUTS_SHA: ${{github.event.inputs.sha}} + GITHUB_EVENT_INPUTS_REPO: ${{ github.event.inputs.repo }} + STEPS_GET_JOB_OUTPUTS_URL: ${{ steps.get_job.outputs.url }} + JOB_STATUS: ${{ job.status }} diff --git a/.github/workflows/test-tpg.yml b/.github/workflows/test-tpg.yml index 9edca790e1ec..506df032ad3a 100644 --- a/.github/workflows/test-tpg.yml +++ b/.github/workflows/test-tpg.yml @@ -45,12 +45,16 @@ jobs: run: | curl -X POST -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \ -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${{github.event.inputs.sha}}" \ + "https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${GITHUB_EVENT_INPUTS_SHA}" \ -d '{ - "context": "${{ github.event.inputs.repo }}${{ env.status_suffix }}", - "target_url": "${{ steps.get_job.outputs.url }}", + "context": "${GITHUB_EVENT_INPUTS_REPO}${{ env.status_suffix }}", + "target_url": "${STEPS_GET_JOB_OUTPUTS_URL}", "state": "pending" }' + env: + GITHUB_EVENT_INPUTS_SHA: ${{github.event.inputs.sha}} + GITHUB_EVENT_INPUTS_REPO: ${{ github.event.inputs.repo }} + STEPS_GET_JOB_OUTPUTS_URL: ${{ steps.get_job.outputs.url }} - name: Checkout Repository uses: actions/checkout@v4 with: @@ -92,9 +96,14 @@ jobs: run: | curl -X POST -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \ -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${{github.event.inputs.sha}}" \ + "https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${GITHUB_EVENT_INPUTS_SHA}" \ -d '{ - "context": "${{ github.event.inputs.repo }}${{ env.status_suffix }}", - "target_url": "${{ steps.get_job.outputs.url }}", - "state": "${{ job.status }}" + "context": "${GITHUB_EVENT_INPUTS_REPO}${{ env.status_suffix }}", + "target_url": "${STEPS_GET_JOB_OUTPUTS_URL}", + "state": "${JOB_STATUS}" }' + env: + GITHUB_EVENT_INPUTS_SHA: ${{github.event.inputs.sha}} + GITHUB_EVENT_INPUTS_REPO: ${{ github.event.inputs.repo }} + STEPS_GET_JOB_OUTPUTS_URL: ${{ steps.get_job.outputs.url }} + JOB_STATUS: ${{ job.status }}