Skip to content

ci: fix Solidity action output handling#6

Open
AdekunleBamz wants to merge 1 commit intobifrost-platform:masterfrom
AdekunleBamz:ci/fix-solidity-action-output
Open

ci: fix Solidity action output handling#6
AdekunleBamz wants to merge 1 commit intobifrost-platform:masterfrom
AdekunleBamz:ci/fix-solidity-action-output

Conversation

@AdekunleBamz
Copy link

This PR fixes an issue in the custom Solidity CI action where solc output was redirected to a literal file named OUTPUT_PATH instead of the configured output file, which could hide compiler errors and make CI unreliable.

Changes:

  • actions/solidity-0.6/entrypoint.sh
    • Correctly writes solc output to the $OUTPUT_PATH file
    • Initializes/clears errors, codesize, and $OUTPUT_PATH for each run
    • Improves quoting for paths/inputs to avoid edge-case failures
  • .github/workflows/solidity-actions.yml
    • Runs CI on pull_request in addition to push
    • Updates checkout action to actions/checkout@v4

Fixes a bug where the compile output was written to a literal file named OUTPUT_PATH instead of the configured output path. Also runs the workflow on pull requests and updates checkout to v4.
Copilot AI review requested due to automatic review settings January 11, 2026 17:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug in the custom Solidity CI action where the solc compiler output was being redirected to a literal file named OUTPUT_PATH instead of using the configured output file path stored in the $OUTPUT_PATH variable. This bug could hide compiler errors and make CI checks unreliable.

Changes:

  • Fixed the critical variable expansion bug in solc output redirection
  • Added initialization/clearing of output files (errors, codesize, OUTPUT_PATH) at script start
  • Improved error handling with || exit 1 and || true where appropriate
  • Enhanced path and variable quoting throughout the script for robustness
  • Updated GitHub Actions workflow to trigger on pull requests in addition to pushes
  • Updated checkout action from v2 to v4

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
actions/solidity-0.6/entrypoint.sh Fixed critical OUTPUT_PATH bug, added output file initialization, improved quoting and error handling throughout the shell script
.github/workflows/solidity-actions.yml Added pull_request trigger and updated checkout action to v4

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

echo "$1" >> codesize
solc --optimize --combined-json bin-runtime "$1" --allow-paths "$SOURCE_DIR" > "$1".json
CODESIZE=$(cat "$1".json | jq '.contracts[] | select(."bin-runtime" != "") | ."bin-runtime"' | tail -1 | wc -m)
echo $CODESIZE >> codesize
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable CODESIZE should be quoted for consistency with the quoting improvements made elsewhere in this script. While this line works correctly because echo is used, maintaining consistent quoting practices helps prevent potential issues if the code is modified in the future.

Suggested change
echo $CODESIZE >> codesize
echo "$CODESIZE" >> codesize

Copilot uses AI. Check for mistakes.
Comment on lines 23 to 27
echo $CODESIZE >> codesize
CODESIZE=`expr $CODESIZE / 2 - 1`
PERCENT=`expr $CODESIZE \* 100 / 24576`

echo $PERCENT\% >> codesize
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables PERCENT and CODESIZE should be quoted for consistency with the quoting improvements made elsewhere in this script. While these lines work correctly in their current context, maintaining consistent quoting practices helps prevent potential issues if the code is modified in the future.

Suggested change
echo $CODESIZE >> codesize
CODESIZE=`expr $CODESIZE / 2 - 1`
PERCENT=`expr $CODESIZE \* 100 / 24576`
echo $PERCENT\% >> codesize
echo "$CODESIZE" >> codesize
CODESIZE=`expr $CODESIZE / 2 - 1`
PERCENT=`expr $CODESIZE \* 100 / 24576`
echo "$PERCENT%" >> codesize

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants