@@ -44,36 +44,36 @@ jobs:
4444 run : |
4545 # Define the target directory
4646 TARGET_DIR="."
47-
47+
4848 # Fetch deleted files in the target directory
4949 DELETED_FILES=$(git diff --diff-filter=D --name-only HEAD -- "$TARGET_DIR")
50-
50+
5151 # Fetch added/modified files in the target directory
5252 MODIFIED_FILES=$(git diff --diff-filter=ACM --name-only HEAD -- "$TARGET_DIR")
53-
53+
5454 # Create a temporary file for JSON output
5555 FILE_CHANGES_JSON_FILE=$(mktemp)
56-
56+
5757 # Initialize JSON structure
5858 echo '{ "deletions": [], "additions": [] }' > "$FILE_CHANGES_JSON_FILE"
59-
59+
6060 # Add deletions
6161 for file in $DELETED_FILES; do
6262 jq --arg path "$file" '.deletions += [{"path": $path}]' "$FILE_CHANGES_JSON_FILE" > "$FILE_CHANGES_JSON_FILE.tmp"
6363 mv "$FILE_CHANGES_JSON_FILE.tmp" "$FILE_CHANGES_JSON_FILE"
6464 done
65-
65+
6666 # Prepare additions (new or modified files)
6767 for file in $MODIFIED_FILES; do
6868 jq --rawfile content "$file" --arg path "$file" \
6969 '.additions += [{"path": $path, "contents": ($content | @base64)}]' \
7070 "$FILE_CHANGES_JSON_FILE" > "$FILE_CHANGES_JSON_FILE.tmp"
7171 mv "$FILE_CHANGES_JSON_FILE.tmp" "$FILE_CHANGES_JSON_FILE"
7272 done
73-
73+
7474 # Create a temporary file for the final JSON payload
7575 JSON_PAYLOAD_FILE=$(mktemp)
76-
76+
7777 # Construct the final JSON using jq and store it in a file
7878 jq -n --arg repo "$GITHUB_REPOSITORY" \
7979 --arg branch "$GITHUB_HEAD_REF" \
@@ -100,7 +100,7 @@ jobs:
100100 }
101101 }
102102 }' > "$JSON_PAYLOAD_FILE"
103-
103+
104104 # Call GitHub API
105105 curl https://api.github.com/graphql -f \
106106 -sSf -H "Authorization: Bearer $GITHUB_TOKEN" \
0 commit comments