TIL Accessing a secret in a GitHub Action
I'm setting up git scraping to keep track of how many songs I have scrobbed on last.fm
. I forked this project and started modifying .github/workflows/scrape.yml
to meet my needs. The last.fm
docs for user.getInfo
say that api_key
is Required. How can I store my API key as a secret and access it in scrape.yml
? The docs have a section on accessing the secret in bash. In the end, the line that uses the secret looks like this:
curl --request GET --url \
"https://ws.audioscrobbler.com/2.0?method=user.getinfo \
&user=bbbbbbbbrie&format=json \
&api_key=${{ secrets.LASTFM_API_KEY }}" \
| jq . > incidents.json
This assumes that the secret has been added.
ℹ️ About this TIL snippet: Created 2023-01-02T00:01:09-05:00 · View the source