Skip to content

Commit 4e78462

Browse files
Split into two steps
Signed-off-by: Dimitar Dimitrov <[email protected]>
1 parent 21230d1 commit 4e78462

File tree

1 file changed

+29
-21
lines changed

1 file changed

+29
-21
lines changed

.github/workflows/update-vendored-mimir-prometheus.yml

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,40 @@ jobs:
2626
update-mimir-prometheus:
2727
runs-on: ubuntu-latest
2828
steps:
29-
- name: Determine branch names
30-
id: branch-names
29+
- name: Determine branch names (repository_dispatch)
30+
id: branch-names-dispatch
31+
if: github.event_name == 'repository_dispatch'
32+
env:
33+
MIMIR_BRANCH: ${{ github.event.client_payload.branch_name }}
3134
run: |
32-
if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
33-
# For repository_dispatch, use the branch_name from client_payload for mimir_prometheus_branch.
34-
# The main use case is for weekly branches, so we just use the same branch name here too.
35-
MIMIR_PROMETHEUS_BRANCH="${{ github.event.client_payload.branch_name }}"
36-
MIMIR_BRANCH=$MIMIR_PROMETHEUS_BRANCH
37-
echo "Triggered by repository_dispatch"
38-
echo "Using mimir-prometheus branch from payload: $MIMIR_PROMETHEUS_BRANCH"
39-
else
40-
# For workflow_dispatch, use the input values
41-
MIMIR_BRANCH="${{ inputs.mimir_branch }}"
42-
MIMIR_PROMETHEUS_BRANCH="${{ inputs.mimir_prometheus_branch }}"
43-
echo "Triggered by workflow_dispatch"
44-
echo "Using input values - mimir branch: $MIMIR_BRANCH, mimir-prometheus branch: $MIMIR_PROMETHEUS_BRANCH"
45-
fi
35+
# For repository_dispatch, use the env-injected mimir_prometheus_branch.
36+
# The main use case is for weekly branches, so we just use the same branch name here too.
37+
echo "Triggered by repository_dispatch"
38+
echo "Using mimir-prometheus branch from payload: $MIMIR_PROMETHEUS_BRANCH"
4639
4740
echo "mimir_branch=$MIMIR_BRANCH" >> $GITHUB_OUTPUT
4841
echo "mimir_prometheus_branch=$MIMIR_PROMETHEUS_BRANCH" >> $GITHUB_OUTPUT
4942
43+
- name: Determine branch names (workflow_dispatch)
44+
id: branch-names-manual
45+
if: github.event_name == 'workflow_dispatch'
46+
env:
47+
MIMIR_BRANCH: ${{ inputs.mimir_branch }}
48+
MIMIR_PROMETHEUS_BRANCH: ${{ inputs.mimir_prometheus_branch }}
49+
run: |
50+
# For workflow_dispatch, use the env-injected branch names.
51+
echo "Triggered by workflow_dispatch"
52+
echo "Using input values - mimir branch: $MIMIR_BRANCH, mimir-prometheus branch: $MIMIR_PROMETHEUS_BRANCH"
53+
54+
echo "mimir_branch=$MIMIR_BRANCH" >> $GITHUB_OUTPUT
55+
echo "mimir_prometheus_branch=$MIMIR_PROMETHEUS_BRANCH" >> $GITHUB_OUTPUT
56+
57+
- name: Determine branch names (combined)
58+
id: branch-names
59+
run: |
60+
echo "mimir_branch=${{ steps.branch-names-dispatch.outputs.mimir_branch || steps.branch-names-manual.outputs.mimir_branch }}" >> $GITHUB_OUTPUT
61+
echo "mimir_prometheus_branch=${{ steps.branch-names-dispatch.outputs.mimir_prometheus_branch || steps.branch-names-manual.outputs.mimir_prometheus_branch }}" >> $GITHUB_OUTPUT
62+
5063
- name: Check out repository
5164
uses: actions/checkout@v4
5265
with:
@@ -61,11 +74,6 @@ jobs:
6174
# We only use this to run `go mod` commands, so it doesn't need to follow the version used in the Dockerfile.
6275
go-version: "1.24.3"
6376

64-
- name: Get current mimir-prometheus version
65-
id: get-current-version
66-
run: |
67-
68-
6977
# This job uses "mimir-vendoring bot" instead of "github-actions bot" (secrets.GITHUB_TOKEN)
7078
# because any events triggered by the later don't spawn GitHub actions.
7179
# Refer to https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow

0 commit comments

Comments
 (0)