Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions sync-r2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,18 @@ purge_paths=(
"/soljson.js"
)
while IFS= read -r path; do
purge_paths+=("/${path}")
done < <(find . \( -wholename '*/list.*' -o -wholename '*/*-latest' -o -wholename '*/*-latest.*' \) | cut --characters 2-)
purge_paths+=("${path}")
done < <(find . \( -wholename '*/list.*' -o -wholename '*/*-latest' -o -wholename '*/*-latest.*' \) | cut -c 2-)
Copy link
Member

@r0qs r0qs Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change to -c is needed? I see the commit message: "Correct cut command in sync-r2.sh" but I don't know for what reason you cannot use --characters. The man page says:

-c, --characters=LIST select only these characters

So both options should be valid. Is this an issue with the current version of cut being used by the GH action?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, sorry it's just that on osx (where I tested the script) cut doesn't support --character but only -c.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why we can't have nice things :(

The outdated shell utils that macOS ships with are a pain.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, sorry it's just that on osx (where I tested the script) cut doesn't support --character but only -c.

Right, so can you revert that change?


purge_payload="$(jq --null-input \
--arg host "https://${cloudflare_cache_host}" \
'{"files": ($ARGS.positional | map($host + .))}' \
--args -- "${purge_paths[@]}"
)"

# Print the payload to check purged files
echo "$purge_payload"

curl --fail --show-error --silent \
-X POST "https://api.cloudflare.com/client/v4/zones/${cloudflare_zone_id}/purge_cache" \
-H "Authorization: Bearer ${cloudflare_api_token}" \
Expand Down
Loading