File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ name: build
77
88on :
99 workflow_dispatch :
10+ inputs :
11+ target-branch :
12+ description : " The branch, tag, or git commit sha to build"
13+ required : true
14+ default : " main"
1015 workflow_run :
1116 workflows : ["Quick Checks"]
1217 types :
@@ -29,10 +34,33 @@ permissions:
2934 statuses : write
3035
3136jobs :
37+ get-target-branch :
38+ name : " Determine target branch based on event"
39+ runs-on : ubuntu-latest
40+ outputs :
41+ target-branch : ${{ steps.get-target-branch.outputs.target-branch }}
42+ steps :
43+ - name : Determine target branch
44+ id : get-target-branch
45+ run : |
46+ if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
47+ target_branch=${{ github.event.workflow_run.head_sha }}
48+ elif [[ "${{ github.event_name }}" == "push" ]]; then
49+ target_branch=${{ github.ref }}
50+ elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
51+ target_branch=${{ github.event.inputs.target-branch }}
52+ else
53+ echo "Unexpected event name: ${{ github.event_name }}"
54+ exit 1
55+ fi
56+ echo "target-branch=${target_branch}" | tee -a "${GITHUB_OUTPUT}"
57+
3258 get-product-version :
3359 name : " Determine intended Terraform version"
3460 if : ${{ github.event.action != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
3561 runs-on : ubuntu-latest
62+ needs :
63+ - get-target-branch
3664 outputs :
3765 product-version : ${{ steps.get-product-version.outputs.product-version }}
3866 product-version-base : ${{ steps.get-product-version.outputs.base-product-version }}
4371
4472 steps :
4573 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
74+ with :
75+ ref : ${{ needs.get-target-branch.outputs.target-branch }}
4676 - name : Get Package Name
4777 id : get-pkg-name
4878 run : |
You can’t perform that action at this time.
0 commit comments