Keep GitHub Actions secrets out of the log
A workflow can use a secret without printing it. Masking is not enough if you echo the value, pass it to a tool that logs flags, or write it into an artifact.
GitHub Actions will mask a secret that appears exactly in the log, and that is not the same thing as keeping the secret safe. I treat a workflow as a place a value can leak, and I write the steps so the value never has to be printed in the first place.
Use the secret, do not echo it
The value belongs in an environment variable on the step that needs it, referenced as `${{ secrets.NAME }}`. I do not `echo` it "just to confirm it is set." I do not pass it on a command line that a tool might reprint in verbose mode. I do not write it into `$GITHUB_OUTPUT`, a comment, or a pull request body.
If I need to know whether the secret is present, I check that the variable is non-empty and print "present" or "missing." That is enough.
Artifacts and forks
Logs are only one outlet. A secret that is written into a built file, a test fixture, a screenshot, or an uploaded artifact is now in storage, and storage gets copied. I keep production credentials out of jobs that upload workspace tarballs, and I do not run those jobs on pull requests from forks.
Fork pull requests should not see repository secrets. That is a GitHub default I do not try to clever around. If a workflow needs a token to comment on a PR, I use a carefully scoped token and I assume the comment could become public.
Permissions stay small
The `GITHUB_TOKEN` in a workflow should get the permissions that job needs, not the kitchen sink. A job that runs tests usually needs no write access to the repo. A job that creates a release needs that, and only on the branch I intend.
I also avoid passing a personal access token when the job token will do. A personal token is a person. It is harder to rotate in a hurry, and it often has more scope than the job.
Rotation is part of the design
A secret you cannot rotate without a ceremony will live too long. I prefer secrets that can be replaced in the repo settings, with the workflow reading only the current name. Old values should stop working, and I should not have to edit five files to make that happen.
None of this is exotic. Most leaks I have seen were an `echo`, a debug flag, or a zip of the workspace. If the workflow can do its job without the secret ever appearing in a string you can scroll, you are on the right side of the problem. The GitHub security guide for secrets is worth reading once a year, even if you think you already know it.