Skip to content

Commit 9e2eedd

Browse files
author
Roman
committed
add labels checker
1 parent edf482e commit 9e2eedd

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

.github/workflows/e2e-subtensor-tests.yaml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,46 @@ jobs:
5252
outputs:
5353
image-name: ${{ steps.set-output.outputs.image-name }}
5454
steps:
55-
- name: Set Docker image tag based on branch
55+
- name: Set Docker image tag based on label or branch
5656
id: set-output
5757
run: |
58-
ref="${{ github.ref_name }}"
59-
if [[ "$ref" == "master" ]]; then
60-
image="ghcr.io/opentensor/subtensor-localnet:main"
58+
echo "Event: $GITHUB_EVENT_NAME"
59+
echo "Branch: $GITHUB_REF_NAME"
60+
61+
echo "Reading labels ..."
62+
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
63+
labels=$(jq -r '.pull_request.labels[].name' "$GITHUB_EVENT_PATH")
6164
else
62-
image="ghcr.io/opentensor/subtensor-localnet:devnet-ready"
65+
labels=""
6366
fi
64-
echo "Using image: $image"
67+
68+
image=""
69+
70+
for label in $labels; do
71+
echo "Found label: $label"
72+
case "$label" in
73+
"subtensor-localnet:main")
74+
image="ghcr.io/opentensor/subtensor-localnet:main"
75+
;;
76+
"subtensor-localnet:testnet")
77+
image="ghcr.io/opentensor/subtensor-localnet:testnet"
78+
;;
79+
"subtensor-localnet:devnet")
80+
image="ghcr.io/opentensor/subtensor-localnet:devnet"
81+
;;
82+
esac
83+
done
84+
85+
if [[ -z "$image" ]]; then
86+
# fallback to default based on branch
87+
if [[ "${GITHUB_REF_NAME}" == "master" ]]; then
88+
image="ghcr.io/opentensor/subtensor-localnet:main"
89+
else
90+
image="ghcr.io/opentensor/subtensor-localnet:devnet-ready"
91+
fi
92+
fi
93+
94+
echo "✅ Final selected image: $image"
6595
echo "image-name=$image" >> "$GITHUB_OUTPUT"
6696

6797
- name: Log in to GitHub Container Registry

0 commit comments

Comments
 (0)