Skip to content

Commit 046364e

Browse files
fix: change conditions for pre-publish (#385)
### Description This PR fixes failing pre-publish job and introduces passing output to publish job instead. ### Checklist - [ ] `README.md` has been updated or is not required - [ ] push trigger tests - [ ] manual release test - [ ] automated releases test - [ ] pull request trigger tests - [ ] schedule trigger tests - [ ] workflow errors/warnings reviewed and addressed ### Testing done Publish done: https://github.com/splunk/test-addonfactory-repo/actions/runs/13566246210/job/37920798879 Publish skipped: https://github.com/splunk/test-addonfactory-repo/actions/runs/13565248938 https://github.com/splunk/test-addonfactory-repo/actions/runs/13548190067/job/37866019352 --------- Co-authored-by: kdoroszko-splunk <[email protected]>
1 parent 9c42e42 commit 046364e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

.github/workflows/reusable-build-test-release.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -987,17 +987,17 @@ jobs:
987987
shell: bash
988988
run: |
989989
python3.7 -m pip install poetry==1.5.1
990+
export POETRY_REPOSITORIES_SPLUNK_ADD_ON_UCC_MODINPUT_TEST_URL=https://github.com/splunk/addonfactory-ucc-test.git
991+
export POETRY_HTTP_BASIC_SPLUNK_ADD_ON_UCC_MODINPUT_TEST_USERNAME=${{ secrets.SA_GH_USER_NAME }}
992+
export POETRY_HTTP_BASIC_SPLUNK_ADD_ON_UCC_MODINPUT_TEST_PASSWORD=${{ secrets.GH_TOKEN_ADMIN }}
993+
git config --global --add url."https://${{ secrets.GH_TOKEN_ADMIN }}@github.com".insteadOf https://github.com
994+
git config --global --add url."https://${{ secrets.GH_TOKEN_ADMIN }}@github.com".insteadOf ssh://[email protected]
990995
- name: modinput-test-prerequisites
991996
if: steps.download-openapi.conclusion != 'skipped'
992997
shell: bash
993998
env:
994999
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
9951000
run: |
996-
export POETRY_REPOSITORIES_SPLUNK_ADD_ON_UCC_MODINPUT_TEST_URL=https://github.com/splunk/addonfactory-ucc-test.git
997-
export POETRY_HTTP_BASIC_SPLUNK_ADD_ON_UCC_MODINPUT_TEST_USERNAME=${{ secrets.SA_GH_USER_NAME }}
998-
export POETRY_HTTP_BASIC_SPLUNK_ADD_ON_UCC_MODINPUT_TEST_PASSWORD=${{ secrets.GH_TOKEN_ADMIN }}
999-
git config --global --add url."https://${{ secrets.GH_TOKEN_ADMIN }}@github.com".insteadOf https://github.com
1000-
git config --global --add url."https://${{ secrets.GH_TOKEN_ADMIN }}@github.com".insteadOf ssh://[email protected]
10011001
poetry install --only modinput
10021002
if [ -f "tests/ucc_modinput_functional/tmp/openapi.json" ]; then
10031003
poetry run ucc-test-modinput -o tests/ucc_modinput_functional/tmp/openapi.json -t ${{ steps.download-openapi.outputs.download-path }}/tmp/
@@ -2897,9 +2897,11 @@ jobs:
28972897
pre-publish:
28982898
if: ${{ !cancelled() }}
28992899
# The following line will rename 'pre-publish' to 'pre-publish-not_main_pr' when PR is created towards main branch
2900-
# It is necessary to avoid confusion caused by githubactions considering pre-publish for both push to develop branch
2900+
# It is necessary to avoid confusion caused by github actions considering pre-publish for both push to develop branch
29012901
# and pull_request to main branch events.
29022902
name: ${{ github.event_name == 'pull_request' && github.base_ref == 'main' && 'pre-publish' || 'pre-publish-not_main_pr' }}
2903+
outputs:
2904+
run-publish: ${{ steps.check.outputs.run-publish }}
29032905
needs:
29042906
- validate-custom-version
29052907
- meta
@@ -2929,17 +2931,14 @@ jobs:
29292931
if [[ "$RUN_PUBLISH" != *'false'* ]]
29302932
then
29312933
echo "run-publish=true" >> "$GITHUB_OUTPUT"
2934+
echo "Publish conditions are met."
29322935
else
29332936
echo "run-publish=false" >> "$GITHUB_OUTPUT"
2937+
echo "Publish conditions are not met."
29342938
fi
2935-
- name: exit without publish
2936-
if: ${{ steps.check.outputs.run-publish == 'false' || ( github.event.action == 'labeled') }}
2937-
run: |
2938-
echo "Expand check step to see which job has failed pre-publish step."
2939-
exit 1
29402939
29412940
publish:
2942-
if: ${{ !cancelled() && needs.pre-publish.result == 'success' && (github.event_name == 'push' || needs.validate-custom-version.result == 'success') }}
2941+
if: ${{ !cancelled() && needs.pre-publish.outputs.run-publish == 'true' && (github.event_name == 'push' || needs.validate-custom-version.result == 'success') }}
29432942
name: ${{ github.event.inputs.custom-version == '' && 'publish' || 'publish-custom-version' }}
29442943
needs:
29452944
- pre-publish

0 commit comments

Comments
 (0)