简体   繁体   English

GitHub Actions - *一些*空的环境秘密

[英]GitHub Actions - *some* empty env secrets

We have a specific branch in a specific repository that doesn't get all the secrets in the workflow action.我们在特定存储库中有一个特定分支,它不会获取工作流操作中的所有秘密。

Ie, some of the secrets seem empty even though they are all defined as organization secrets available to all repositories within the organization.即,一些秘密看起来是空的,即使它们都被定义为组织内所有存储库可用的组织秘密。

所有这些环境。 vars 直接派生自秘密 ${{ 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.我什至尝试在特定的 repo 上设置这些秘密,但它们仍然是空的。

*** 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/

It turns out that it was all because of a limit on the number of secrets on GitHub.事实证明,这一切都是因为 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.显然,只有前 100 个组织机密被转移到存储库,因此一些基于最后(按字母顺序)机密的环境变量变为空。

To overcome the issue temporarily I deleted some unused secrets to get below 100 organization secrets, and the deploy works normally again.为了暂时解决这个问题,我删除了一些未使用的机密以使组织机密低于 100,并且部署再次正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM