Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.github/workflows: purge Cloudflare cache on deployment #1893

Merged
merged 1 commit into from
Oct 2, 2024

Commits on Oct 1, 2024

  1. .github/workflows: purge Cloudflare cache on deployment

    We use Cloudflare in front of the git-scm.com website in order to cache
    traffic that would otherwise be going directly to GitHub Pages. However,
    this cache needs to be purged whenever the actual site is updated,
    otherwise clients will have to wait out Cloudflare's and their own
    browser's cache TTL until they see the new content.
    
    Usually this is just fine: for high priority deployments where the new
    content should be reflected immediately, someone can manually purge the
    cache by logging into Cloudflare and clicking on the "Purge everything"
    button.
    
    But sometimes folks aren't around to log into Cloudflare, don't have
    permissions to, etc. Let's remove the need to have anyone log into
    Cloudflare and instead purge the cache on deployment so that the site is
    more up-to-date more quickly upon deployment.
    
    (Note that this only purges the cache for git-scm.com, not git-scm.org.
    The former receives the vast majority of traffic, and when purging
    manually I almost always skipped git-scm.org without complaints. Let's
    avoid having two API keys and instead let git-scm.org lag slightly
    behind git-scm.com after a deployment).
    
    To generate the API key, I logged into Cloudflare and created an API
    token[1] that has permissions limited to "Zone.Cache Purge" for all
    zones in the Git project's Cloudflare account. The token is stored as a
    repository secret[2].
    
    [1]: https://developers.cloudflare.com/fundamentals/api/get-started/create-token/
    [2]: https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions
    
    Signed-off-by: Taylor Blau <me@ttaylorr.com>
    ttaylorr committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    0d22411 View commit details
    Browse the repository at this point in the history