首页 > 解决方案 > Git Hub actions for multiple repos

问题描述

Just wondering if there is a way to use a Github action across multiple repos. Basically seeing if there is a similar way to do something similar to this from azure devops.

I have the same script i need to run on multiple repos, which currently I have created a template of so I can quickly create it across repos, however if I need to modify that template I will need to change it in all the repos which would be fairly time consuming.

My thinking is that i can create a plugin similar to the ones you can get on the marketplace and create a step to use that, but is this the best way of doing it/is there a way to do this privately.

Thanks

EDIT: With some looking i have got a action that looks like the following (ignore the names etc that are still in from a sample)

name: "Hello World"
description: "Greet someone"
inputs: 
  unity-key: 
    default: ""
    description: "Unity Key"
    required: true
runs: 
  using: composite
  steps: 
    - uses: game-ci/unity-builder@v2
      env: 
        UNITY_LICENSE: "${{ inputs.unity-key }}"
      with: 
        buildMethod: UnityEditor.SyncVS.SyncSolution
        targetPlatform: StandaloneWindows
    - uses: nikeee/docfx-action@v1.0.0
      name: Build
      with: 
        args: Documentation/docfx.json
    - uses: actions/upload-artifact@v2 
      name: "Upload site artifact"
      with: 
        name: _site
        path: _site

and then calling it in another repos step process as following snippet. It does find the action and attempts to run it. But then errors out. Looking around i can not see any references that say i can have uses steps within another action, but this seems like a very limited feature, so not sure if im just missing something.

jobs:
  # This workflow contains a single job called "build"
  build:
      runs-on: ubuntu-latest
      steps:
      - name: Checkout
        uses: actions/checkout@v2
        # with:
        #   submodules: true
      
      - uses: Greener-Games/Generate-Documentation@v1.0.5
        with:
          unity-key: ${{ secrets.UNITY_LICENCE_2019_4_12F1 }}

标签: github-actions

解决方案


推荐阅读