Modify entrypoint.sh to handle exit codes #63
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes Made
Exit code capture: Added exit_code=0 initialization and || exit_code=$? to capture the exit code from the oasdiff command without causing the script to exit immediately due to set -e.
Continued execution: Even if oasdiff returns a non-zero exit code (when differences are found with --fail-on-diff), the script continues to execute and properly handles the output.
Output handling: Restored the redirection to $GITHUB_OUTPUT for both the diff output and "No changes" cases to ensure the content goes into the multiline output format.
Proper delimiter closure: The closing delimiter is always written to complete the GitHub Actions multiline output format.
Exit with original code: The script exits with the original exit code from oasdiff, preserving the intended behavior where the action fails when differences are found and --fail-on-diff is true.
How This Fixes the Issue
The original problem was that when oasdiff found differences and returned exit code 1 (with --fail-on-diff enabled), the set -e directive caused the script to immediately terminate before:
Writing the diff output to $GITHUB_OUTPUT
Writing the closing delimiter
This left GitHub Actions with an incomplete multiline output format, causing the "invalid format delimiter not found before end of file" error.