【问题标题】:Can't I use the secret value of the repository when using the Github Action of another repository?使用另一个仓库的 Github Action 时不能使用仓库的 secret 值吗?
【发布时间】:2022-01-13 23:10:50
【问题描述】:

我正在为 Marketplace 的发布创建一个 Github Action。 https://github.com/dooboolab/relay-schema-bot

在使用另一个仓库的 Github Action 时不能使用该仓库的 secret 值吗?

也就是说,我想使用要调用的存储库的秘密值,而不是调用方的秘密值。

我想以其他方式做到这一点。 因为没有使用 Jay-flow/relay-schema-bot 存储库的秘密值。

name: Relay Schema bot

on:
  push:
    branches:
      - master
    paths:
      - 'schema.graphql'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: dooboolab/relay-schema-bot@master
        with:
          token: ${{ secrets.PAT }}
          repo-url: https://github.com/Jay-flow/artifacts-pro

          # I don't want to enter it as below.
          # because the secret value of the Jay-flow/relay-schema-bot repository is not used.
          app-id: ${{ secrets.APP_ID }}
          app-private-key: ${{ secrets.APP_PRIVATE_KEY }}

从我创建的 Github 应用程序发出拉取请求需要 APP_PRIVATE_KEY 值。问题是用户不应该知道这个值。 有没有办法让这成为可能?

注意 https://github.com/dooboolab/relay-schema-bot/blob/master/src/createPullRequest.ts#L18

【问题讨论】:

    标签: github github-actions github-api


    【解决方案1】:

    这似乎不可能,来自documentation encrypted secret

    • 您的操作的用户能够提供使所述操作能够在目标存储库上创建 PR 的秘密
    • 或者您的操作可能会对该目标存储库调用一个专用操作,并且该专用操作将负责返回相应的机密。
      但是,没有什么能阻止其他用户对目标存储库调用相同的专用操作:秘密将不再是秘密。

    【讨论】:

    • 谢谢 :) 我需要另一种方式。
    猜你喜欢
    • 2013-09-28
    • 1970-01-01
    • 2019-03-04
    • 2021-05-01
    • 2013-10-03
    • 1970-01-01
    • 2012-10-06
    • 1970-01-01
    • 2011-10-19
    相关资源
    最近更新 更多