GitHub 操作 单个回购中的多个操作

GitHub Actions Multiple action in a single repo

我在 Github 存储库中有一个应用程序代码,我想自定义我的管道的某些阶段,并想编写我自己的自定义操作(在私有存储库中),因为这些自定义操作必须放置在要执行操作的存储库中 运行 我可以在单个存储库中保存多个操作吗?

还有什么方法可以在私人仓库中的组织内使用这些仓库?

If you're building an action that you don't plan to make available to the public, you can store the action's files in any location in your repository. If you plan to combine action, workflow, and application code in a single repository, we recommend storing actions in the .github directory. For example, .github/actions/action-a and .github/actions/action-b.

来源:https://docs.github.com/en/actions/creating-actions/about-custom-actions#choosing-a-location-for-your-action

name: Workflow using an action
on:
  [your trigger here ...]

jobs:
  job:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: ./.github/actions/action-a

这适用于组织中的私有存储库,如果您检出包含该操作的私有存储库并像上面的示例那样相对地引用它。