Conversation
There was a problem hiding this comment.
Pull request overview
Updates the GitHub Actions Fastly purge workflow to target a purge-by-key mechanism for surrogate key invalidation.
Changes:
- Switches the Fastly API request from
.../purge/{KEY}to.../purgeand adds aSurrogate-Keyrequest header.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge" \ | ||
| -H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}" \ | ||
| -H "Surrogate-Key: ${{ env.KEY }}" |
There was a problem hiding this comment.
The workflow now POSTs to /service/${FASTLY_SERVICE_ID}/purge with a Surrogate-Key request header and no body. Elsewhere in this repo, surrogate-key purging is implemented as a POST to /service/{service_id}/purge/{key} (see fastly/utils.py:44-48), so this change likely breaks purging (or at least makes it inconsistent with the app’s purge behavior). Recommend switching back to the /purge/${KEY} endpoint, or if you intend to use the multi-key purge endpoint, send the expected JSON payload and required headers (e.g., content-type) instead of only Surrogate-Key.
| "https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge" \ | |
| -H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}" \ | |
| -H "Surrogate-Key: ${{ env.KEY }}" | |
| "https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge/${{ env.KEY }}" \ | |
| -H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}" |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 565d1e3b38
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge" \ | ||
| -H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}" \ | ||
| -H "Surrogate-Key: ${{ env.KEY }}" |
There was a problem hiding this comment.
Put surrogate key back into the Fastly purge endpoint
The workflow now posts to .../service/{id}/purge and sends the key only via Surrogate-Key header, but Fastly surrogate-key purging expects the target key to be part of the purge-by-key request path; with curl -f this causes the step to fail on every push/dispatch and prevents cache invalidation for the selected target.
Useful? React with 👍 / 👎.
Description