Adding a secret in the GitHub web interface means a form per secret and a value pasted into a browser. The CLI does the same from your terminal, and it can take a whole dotenv file in one go.
gh secret set MYSECRET --body "$ENV_VALUE"
gh secret set -f .env
The first line sets one secret for the current repository, with the value from an environment variable. If you leave out --body, gh reads the value from standard input, or asks for it in an interactive prompt:
gh secret set MYSECRET < myfile.txt
With -f (--env-file) the names and values come from a dotenv-formatted file. -f - reads them from standard input. The help also says secret values are encrypted locally before they are sent to GitHub.
By default the secret is a repository secret for GitHub Actions. The flags change the level or the app:
--env myenvironmentsets a deployment environment secret.--org myOrgsets an organization secret, and--visibilitytakesall,privateorselected(defaultprivate). With--repos repo1,repo2you name the repositories that may use it.--usersets a secret for your user, available to Codespaces.--app dependabotsets it for Dependabot instead of Actions.
Two caveats. A .env file contains secrets in plain text, so keep it out of the repository and delete it when you are done. And --body puts the value on the command line, so it can end up in your shell history. For anything sensitive I would use standard input or the prompt. I did not run these commands against a real repository here. The details are from gh secret set --help.
Further reading: gh secret set manual
Going deeper: Moving on from hdtv: how to export your TV show list to Trakt.tv