小编Sau*_*ari的帖子

秘密不会从 github 操作秘密传递到 github 操作中的可重用工作流程

我在 github 操作中创建了秘密,并尝试在可重用的工作流程中使用它们,但我无法使其工作,但是,如果我传递从调用者文件中硬编码的秘密,它就可以正常工作

## set_env.yml
name: Sent Env Creds and Vars

on:
  push:
    branches:
      - main
      - dev
  pull_request:
    branches: [ main ]

jobs:
  deploy-dev:
    uses: ./.github/workflows/main.yml
    with:
      AWS_REGION: "us-east-2"
      PREFIX: "dev"
    secrets:
      AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
Run Code Online (Sandbox Code Playgroud)

可重用的工作流程 = main.yml

## main.yml
name: Deploy to AWS  

# Controls when the workflow will run
on:
  workflow_call:
    inputs:
      AWS_REGION:
        required: true
        type: string
      PREFIX:
        required: true
        type: string
    secrets:
      AWS_ACCESS_KEY_ID:
        required: true
      AWS_SECRET_ACCESS_KEY:
        required: true

# A workflow …
Run Code Online (Sandbox Code Playgroud)

github amazon-web-services terraform github-actions

7
推荐指数
1
解决办法
3964
查看次数