Refactor script/sign: add comprehensive env validation and improve error handling#12
Refactor script/sign: add comprehensive env validation and improve error handling#12
Conversation
Co-authored-by: darkangelpraha <183031713+darkangelpraha@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 394fed153c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fi | ||
|
|
||
| for input_file; do | ||
| check_env_vars |
There was a problem hiding this comment.
Validate notarization vars only for zip inputs
Running check_env_vars unconditionally here makes APPLE_ID and APPLE_ID_PASSWORD mandatory even when every input is a non-zip file that only reaches the codesign branch. That is a functional regression from the prior behavior, where non-zip signing only depended on APPLE_DEVELOPER_ID, and it breaks binary-only signing workflows (for example local signing setups without notarization credentials).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR refactors the script/sign shell script to add comprehensive upfront environment variable validation and improve error handling. The script is used in the GitHub Actions deployment workflow to sign macOS binaries and notarize zip archives for production releases.
Changes:
- Added upfront validation for all required environment variables (APPLE_DEVELOPER_ID, APPLE_ID, APPLE_ID_PASSWORD) with clear error reporting
- Changed from silent skip to fail-fast behavior when environment variables are missing
- Enhanced error handling with
set -e, proper error messages to stderr, and explicit argument validation - Improved code safety with proper variable quoting and explicit loop syntax
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The
script/signscript lacked upfront environment variable validation and proper error handling. It would silently skip signing ifAPPLE_DEVELOPER_IDwas unset, making failures hard to diagnose.Changes
check_env_vars()that validates all required env vars (APPLE_DEVELOPER_ID,APPLE_ID,APPLE_ID_PASSWORD) upfront and reports all missing vars at once"$input_file","${APPLE_ID}")for input_file in "$@") and extracted file parameter insign_macos()to local varBefore
After
Breaking change: Script now fails instead of skipping when env vars are unset.
Original prompt
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Continue Tasks: ❌ 1 failed — View all