Skip to content

Commit c77cea0

Browse files
yarikopticclaude
andcommitted
Fix shellcheck warnings in *-ec2.sh
- Separate variable declaration and assignment to avoid masking return values (SC2155) - Add shellcheck disable comment for SC1090 (fixed by a human - gave wrong instructions, claude did to wrong file) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent c05d7b4 commit c77cea0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.github/scripts/cleanup-ec2.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set -eu
66
ENV_FILE=".ec2-session.env"
77
if [ -f "$ENV_FILE" ]; then
88
echo "Loading environment variables from $ENV_FILE..."
9+
# shellcheck disable=SC1090
910
source "$ENV_FILE"
1011
else
1112
echo "Warning: Environment file $ENV_FILE not found."

.github/scripts/launch-ec2.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ echo "# Auto-generated by launch script on $(date)" >> $ENV_FILE
3636

3737
# Run EC2 instance
3838
echo "Launching EC2 instance..."
39-
export INSTANCE_ID=$(aws ec2 run-instances \
39+
INSTANCE_ID=$(aws ec2 run-instances \
4040
--image-id $AMI_ID \
4141
--count 1 \
4242
--instance-type t3.micro \
@@ -46,6 +46,7 @@ export INSTANCE_ID=$(aws ec2 run-instances \
4646
--tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=dandihub-gh-actions}]" \
4747
--query 'Instances[0].InstanceId' \
4848
--output text)
49+
export INSTANCE_ID
4950

5051
if [ -z "$INSTANCE_ID" ]; then
5152
echo "Error: Failed to launch EC2 instance."
@@ -60,10 +61,11 @@ aws ec2 wait instance-status-ok --instance-ids "$INSTANCE_ID"
6061

6162
# Allocate Elastic IP
6263
echo "Allocating Elastic IP..."
63-
export ALLOC_ID=$(aws ec2 allocate-address \
64+
ALLOC_ID=$(aws ec2 allocate-address \
6465
--tag-specifications "ResourceType=elastic-ip,Tags=[{Key=Name,Value=dandihub-gh-actions-eip}]" \
6566
--query 'AllocationId' \
6667
--output text)
68+
export ALLOC_ID
6769

6870
if [ -z "$ALLOC_ID" ]; then
6971
echo "Error: Failed to allocate Elastic IP."
@@ -74,22 +76,24 @@ echo "export ALLOC_ID=$ALLOC_ID" >> $ENV_FILE
7476

7577
# Associate Elastic IP with instance
7678
echo "Associating Elastic IP with instance..."
77-
export EIP_ASSOC=$(aws ec2 associate-address \
79+
EIP_ASSOC=$(aws ec2 associate-address \
7880
--instance-id "$INSTANCE_ID" \
7981
--allocation-id "$ALLOC_ID" \
8082
--query 'AssociationId' \
8183
--output text)
84+
export EIP_ASSOC
8285

8386
if [ -z "$EIP_ASSOC" ]; then
8487
echo "Error: Failed to associate Elastic IP."
8588
exit 1
8689
fi
8790

8891
# Get Elastic IP address
89-
export PUBLIC_IP=$(aws ec2 describe-addresses \
92+
PUBLIC_IP=$(aws ec2 describe-addresses \
9093
--allocation-ids "$ALLOC_ID" \
9194
--query 'Addresses[0].PublicIp' \
9295
--output text)
96+
export PUBLIC_IP
9397

9498
echo "Elastic IP Address: $PUBLIC_IP"
9599
echo "export PUBLIC_IP=$PUBLIC_IP" >> $ENV_FILE

0 commit comments

Comments
 (0)