Skip to content

Commit a69c6d7

Browse files
authored
Merge pull request #18 from ipfs/fix-merkleize
fix: improve error handling
2 parents 5c9a929 + c5dd998 commit a69c6d7

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
## [1.1.2] - 2025-02-26
11+
12+
### Fixed
13+
14+
- Improve error handling and logging when the action is not configured correctly, like when the folder to deploy is not found or empty.
15+
1016
## [1.1.1] - 2025-02-26
1117

1218
### Fixed

action.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,28 @@ runs:
9898
shell: bash
9999
run: |
100100
echo "ℹ️ Merkleizing ${{ inputs.path-to-deploy }} into CAR file"
101-
CID=$(npx ipfs-car pack ${{ inputs.path-to-deploy }} --no-wrap --output build.car 2>&1 | tail -n 1)
101+
102+
# Verify the directory exists
103+
if [ ! -d "${{ inputs.path-to-deploy }}" ]; then
104+
echo "::error::Directory '${{ inputs.path-to-deploy }}' does not exist or is not accessible"
105+
exit 1
106+
fi
107+
108+
# Verify the directory is not empty
109+
if [ -z "$(ls -A ${{ inputs.path-to-deploy }})" ]; then
110+
echo "::error::Directory '${{ inputs.path-to-deploy }}' is empty"
111+
exit 1
112+
fi
113+
114+
# Merkleize the directory into a CAR file
115+
CID=$(ipfs-car pack ${{ inputs.path-to-deploy }} --no-wrap --output build.car 2>&1 | tail -n 1)
116+
117+
# Verify that we got a valid CID
118+
if [ -z "$CID" ]; then
119+
echo "::error::Failed to extract CID from ipfs-car output"
120+
exit 1
121+
fi
122+
102123
echo "cid=$CID" >> "$GITHUB_OUTPUT"
103124
echo $CID
104125
echo "✅ Merkleized path: \`${{ inputs.path-to-deploy }}\` into CAR file with root CID \`$CID\`" >> $GITHUB_STEP_SUMMARY

screenshot-pr-comment.png

-14.7 KB
Loading

0 commit comments

Comments
 (0)