Merge rust-bitcoin/rust-bitcoin#2637: CI: Fix Manage PR job

35687c84fc CI: Fix Manage PR job (Tobin C. Harding)

Pull request description:

  In #2635 we broke the Manage PR CI job but for some reason CI didn't run on that PR so we merged the breakage.

  Fix the script by setting default variables when they are not set. Done with ChatGPT.

ACKs for top commit:
  apoelstra:
    ACK 35687c84fc

Tree-SHA512: 707ad8872468a9eb6292ae3e8d7896a19baf044eaa28d6c45119d4367a7b14a73923a86cf68d64799df43febb35ecccb39422ce0d28f37100c6120a4316240d1
This commit is contained in:
Andrew Poelstra 2024-03-27 23:44:35 +00:00
commit 1f7b01ae83
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 4 additions and 8 deletions

View File

@ -7,14 +7,10 @@ set -euo pipefail
config=.github/labeler.yml
if [ -n "$SCAN_DIR" ];
then
scan_dir="$SCAN_DIR"
else
scan_dir=.
fi
# Define a default value for SCAN_DIR if not set
: "${SCAN_DIR:=.}"
if [ "$1" '!=' "--force" ] && ! git diff --exit-code "$config";
if [ "${1:-default}" '!=' "--force" ] && ! git diff --exit-code "$config";
then
echo "Error: $config is not committed."
echo "Refusing to overwrite it to prevent disaster."
@ -24,7 +20,7 @@ fi
excluded_crates="fuzz|dep_test"
CRATES="`cd "$scan_dir" && cargo metadata --no-deps --format-version 1 | jq -j -r '.packages | map(.manifest_path | rtrimstr("/Cargo.toml") | ltrimstr("'$PWD'/")) | join(" ")'`"
CRATES="`cd "$SCAN_DIR" && cargo metadata --no-deps --format-version 1 | jq -j -r '.packages | map(.manifest_path | rtrimstr("/Cargo.toml") | ltrimstr("'$PWD'/")) | join(" ")'`"
for crate in $CRATES;
do