Home > Blockchain >  GitHub Actions - *some* empty env secrets
GitHub Actions - *some* empty env secrets

Time:11-02

We have a specific branch in a specific repository that doesn't get all the secrets in the workflow action.

I.e., some of the secrets seem empty even though they are all defined as organization secrets available to all repositories within the organization.

all these env. vars are derived directly from secrets ${{ secrets.XXX }}

As you can see in the screenshot, some were empty and some not. Despite all of them being set the same.

I even tried setting those secrets on the specific repo but still they are empty.

*** EDIT ***

Here is the relevant part of the workflow file:

on:
  push:
    branches: [ master ]

  workflow_dispatch:

jobs:
  build:
    name: build
    runs-on: ubuntu-latest
    env:
      REACT_APP_AWS_REGION:               ${{ secrets.REGION }}
      REACT_APP_AWS_ACCESS_KEY_ID:        ${{ secrets.KEY_ID }}
      REACT_APP_AWS_SECRET_ACCESS_KEY:    ${{ secrets.SECRET }}
      REACT_APP_AWS_BUCKET:               ${{ secrets.BUCKET }}
      REACT_APP_COGNITO_REGION:           ${{ secrets.REGION }}
    steps:
      - uses: actions/checkout@v2
      - uses: c-hive/gha-yarn-cache@v1
      - run: yarn install
      - run: yarn run build
      - uses: actions/upload-artifact@v2
        with:
          name: build
          path: build/

CodePudding user response:

It turns out that it was all because of a limit on the number of secrets on GitHub. Apparently, only the first 100 organization secrets are carried over to the repositories, so some of the environment variables which were based on the last (alphabetically-ordered) secrets became empty.

To overcome the issue temporarily I deleted some unused secrets to get below 100 organization secrets, and the deploy works normally again.

GitHub Docs

  • Related