We have a repository named recent-activity which hosts a GitHub action and is available for use to all GitHub users. We want to add a URL on which we can send http requests when the action is run (by any user). However, we don't want to disclose the URL publicly.
Is there any way this can be done?
You can include secrets from your repo into the workflows directly by specifying their name. Let's say you have a secret named URL
then you can simply use it like:
env:
URL: ${{ secrets.URL }}
Now your URL is fetched and you can use it in other commands like this $URL
You'll find on the official documentation everything you need about Github Secrets
Note that the repository users won't have access to the secret, because you need admin
permissions to edit secrets' values. Moreover, secrets won't be shown on the action workflow execution (they will be replaces by ***
in logs).
Everyone will use this secret variable in the workflow the same way, without having access to its value.
Demo
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.