【问题标题】:Github Actions detect author_associationGithub Actions 检测 author_association
【发布时间】:2020-11-21 02:44:05
【问题描述】:

所以我一直在使用 Github Actions 进行几个项目,并且遇到了能够从某个地方获取 author_association 并使用它的 PullApprove。我想设置一些命令,这些命令仅限于author_association == collaborators,但我不确定如何去做。任何建议将不胜感激。

如果你想要一些代码:

name: Command Management

on:
  issue_comment:
    types: [created, edited]

jobs:
  # Automatically reverts commits on request
  revert-commit:
    runs-on: ubuntu-latest
    if: contains(github.event.comment.body, '/revert')
    steps:
      - name: Checkout
        uses: actions/checkout@v2.3.1
      - name: Automatic Revert
        uses: srt32/revert@v0.0.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

【问题讨论】:

  • 如果您对其他解决方案持开放态度,可以将slash-command-dispatch 配置为仅允许具有write 访问权限的协作者执行斜杠命令。这实际上是默认值。
  • 嘿@peterevans。感谢您的推荐,我会坚决考虑它,因为它看起来是一个不错的选择。我已经打开了一些请求的问题

标签: github github-api github-actions


【解决方案1】:

对于它的价值,我可以告诉你,在 PullApprove 我们使用PR author_assiciation from the REST API。看起来问题 cmets 实际上有类似的事情,但在 REST API 或 webhook 事件中没有——我认为您必须调用 GraphQL API 才能获取该信息(获取该问题的 node_id评论该事件并使用它来调用 GraphQL 作为您操作中的自定义步骤?):https://docs.github.com/en/graphql/reference/objects#issuecomment

【讨论】:

    猜你喜欢
    • 2021-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-11
    • 2021-09-19
    • 2020-06-20
    • 1970-01-01
    • 2021-11-06
    相关资源
    最近更新 更多