From f10df13128f7ab336b144e00b95502c1f7a44542 Mon Sep 17 00:00:00 2001 From: Christopher Carroll Smith Date: Wed, 6 Nov 2024 17:33:40 -0500 Subject: [PATCH 1/2] Prevent failure exit code in Github Actions --- .github/workflows/main.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 405f29b..010a287 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,8 +25,11 @@ jobs: env: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} run: | - output=$(poetry publish --build -u __token__ -p $PYPI_TOKEN 2>&1) - if [ $? -ne 0 ]; then + # Attempt to publish and capture output + if poetry publish --build -u __token__ -p $PYPI_TOKEN 2>&1; then + echo "Package published successfully" + else echo "::warning::Version has not been incremented. No new version published." - echo "$output" fi + # Ensure step exits successfully + exit 0 From 5ac0dd171ff4f5b7690008984756146f0012517a Mon Sep 17 00:00:00 2001 From: Christopher Carroll Smith Date: Wed, 6 Nov 2024 17:48:37 -0500 Subject: [PATCH 2/2] Update Github Actions workflow to convert failure to warning in publish step --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 010a287..85c318c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,10 +26,10 @@ jobs: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} run: | # Attempt to publish and capture output - if poetry publish --build -u __token__ -p $PYPI_TOKEN 2>&1; then + if OUTPUT=$(poetry publish --build -u __token__ -p $PYPI_TOKEN 2>&1); then echo "Package published successfully" else - echo "::warning::Version has not been incremented. No new version published." + echo "::warning::Not published to PyPi. Poetry output: $OUTPUT" fi # Ensure step exits successfully exit 0