Entry

Adding secrets to GitHub Actions

Solution

  1. Navigate to https://github.com/OWNER/REPO/settings/secrets/actions
  2. Add a Repository secret
  3. That's it! It can now be used in GitHub Actions
# .github/workflows/using-secrets.yml
name: Example on using secrets
on:
  workflow_dispatch:

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - run: yarn directus-to-data --collection-output src/_data/{{collectionName}}.json -c CollectionName
        env:
          CMS_URL: ${{ secrets.CMS_URL }}
          STATIC_TOKEN: ${{ secrets.STATIC_TOKEN }}