Skip to content

Commit 3a02483

Browse files
authored
chore: Attempt to declutter Github action runs (#17852)
2 parents 9f93d2a + 5da0b7d commit 3a02483

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

.github/workflows/test-network-scenarios.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,37 @@ concurrency:
3434
cancel-in-progress: true
3535

3636
jobs:
37+
check-should-run:
38+
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
39+
runs-on: ubuntu-latest
40+
outputs:
41+
should_run: ${{ steps.check.outputs.should_run }}
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
45+
with:
46+
ref: ${{ github.event.workflow_run.head_sha }}
47+
fetch-depth: 0
48+
persist-credentials: false
49+
- name: Check for semver tag
50+
id: check
51+
run: |
52+
git fetch --tags --force
53+
tag=$(git tag --points-at "${{ github.event.workflow_run.head_sha }}" | head -n1)
54+
if echo "$tag" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+'; then
55+
echo "should_run=true" >> $GITHUB_OUTPUT
56+
echo "Found semver tag: $tag"
57+
else
58+
echo "should_run=false" >> $GITHUB_OUTPUT
59+
echo "No semver tag found for head_sha: ${{ github.event.workflow_run.head_sha }}. Skipping."
60+
fi
61+
3762
deploy-and-test-scenarios:
63+
needs: check-should-run
3864
if: |
39-
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
40-
(github.event_name == 'workflow_dispatch')
65+
always() &&
66+
((github.event_name == 'workflow_run' && needs.check-should-run.outputs.should_run == 'true') ||
67+
(github.event_name == 'workflow_dispatch'))
4168
runs-on: ubuntu-latest
4269
env:
4370
NETWORK_ENV_FILE: /tmp/network.env
@@ -65,10 +92,6 @@ jobs:
6592
run: |
6693
git fetch --tags --force
6794
tag=$(git tag --points-at "${{ github.event.workflow_run.head_sha }}" | head -n1)
68-
if ! echo "$tag" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+'; then
69-
echo "No semver tag found for head_sha: ${{ github.event.workflow_run.head_sha }}. Skipping."
70-
exit 0
71-
fi
7295
semver="${tag#v}"
7396
major_version="${semver%%.*}"
7497
echo "SEMVER=$semver" >> $GITHUB_ENV

0 commit comments

Comments
 (0)