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: don't clear Cloudflare cache unless configured #1895

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

ttaylorr
Copy link
Member

@ttaylorr ttaylorr commented Oct 2, 2024

The recent change in 0d22411 (.github/workflows: purge Cloudflare cache on deployment, 2024-10-01) will cause deployment workflows run in forks of git/git-scm.com to fail, since they will likely not have a Cloudflare token configured in their repository secrets.

Let's make use of a suggestion from Johannes1 and only run this step when the repository is configured with a Cloudflare token.

Note that we can't directly write:

if: ${{ secrets.CLOUDFLARE_TOKEN != '' }}

, because repository secrets cannot be used in job step-level conditionals2. Instead, the GitHub Actions documentation recommends setting the secret as an environment variable, and then using the presence (or absence) of that environment variable's contents as a proxy to determine whether or not the secret is set.

All together, this should un-break deployment workflows in forks of git/git-scm.com for repositories that have not set up a Cloudflare token.

Suggested-by: Johannes Schindelin Johannes.Schindelin@gmx.de

/cc @dscho

.github/workflows/deploy.yml Outdated Show resolved Hide resolved
The recent change in 0d22411 (.github/workflows: purge Cloudflare
cache on deployment, 2024-10-01) will cause deployment workflows run in
forks of git/git-scm.com to fail, since they will likely not have a
Cloudflare token configured in their repository secrets.

Let's make use of a suggestion from Johannes[1] and only run this step
when the repository is configured with a Cloudflare token.

Note that we can't directly write:

    if: ${{ secrets.CLOUDFLARE_TOKEN != '' }}

, because repository secrets cannot be used in job step-level
conditionals[2]. Instead, the GitHub Actions documentation recommends
setting the secret as an environment variable, and then using the
presence (or absence) of that environment variable's contents as a proxy
to determine whether or not the secret is set.

All together, this should un-break deployment workflows in forks of
git/git-scm.com for repositories that have not set up a Cloudflare
token.

[1]: #1893 (review)
[2]: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-using-secrets

Suggested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
@ttaylorr ttaylorr force-pushed the ttaylorr/purge-cloudflare-cache-not-in-forks branch from 5cb2ac2 to da01731 Compare October 2, 2024 18:42
@dscho dscho merged commit 99f96a6 into gh-pages Oct 3, 2024
1 check passed
@dscho dscho deleted the ttaylorr/purge-cloudflare-cache-not-in-forks branch October 3, 2024 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants