I have a repository that hosts a standard jekyll website with github pages. I am trying to add a workflow to update some content with this:
name: Update gallery
on: push
jobs:
update_gallery:
runs-on: ubuntu-latest
steps:
- name: Update gallery
env:
INSTAGRAM_ACCESS_TOKEN: ${{ secrets.INSTAGRAM_ACCESS_TOKEN }}
run: |
echo 'ENV GREP'
env | grep INSTAGRAM
echo 'WC -M'
echo $INSTAGRAM_ACCESS_TOKEN | wc -m
but for some reasons INSTAGRAM_ACCESS_TOKEN is empty. The job outputs:
ENV GREP
INSTAGRAM_ACCESS_TOKEN=
WC -M
0
I've set the secret in the github-pages environment at first, then I tried in a custom environment (I'm not sure what that changes...) but nothing works. Do you know why this environment variable is empty?
@Azeem you were right, I tried adding the github-pages environment and it worked.
That made me re-think that there must be a possibility of creating a secret without an environment. There is! I had missed it in the Settings.
You can create secrets on the repo level instead of in an environment.