Home > OS >  GitHub CI, running a script when murdering in another repository
GitHub CI, running a script when murdering in another repository

Time:06-13

can someone tell me how to run CI in repository #2 when you merge into the master branch in repository #1? I assume that as in gitlab through triggers, like here GitHub Multi-project pipelines, but I can't figure out where to insert it and how to call it correctly

Yamlik code in repository #2 (now the script is run on time, manually and when the merge in this repo occurs in the master branch): name: run autotests

on:
  push:
    branches:    
      - master
  schedule:
    - cron: '0 22 * * *'
  workflow_dispatch:

jobs:
  autotests_regress:
    name: Run tests
    runs-on: ubuntu-latest
    env: 
      working-directory: ./
      KEYWORDS: regress,smoke
    steps:

I can add a branch from another project to the line on push branches somehow

CodePudding user response:

you can trigger a workflow from another repository using an action

so on repo #1 you can add a workflow like this:

on:
  push:
    branches:
      - master

jobs:
  run-tests:
    name: Run tests from another repository
    runs-on: ubuntu-latest
    steps:
      - uses: convictional/[email protected]
        with:
          owner: ${{ github.repository_owner }}
          repo: repo-name
          github_token: ${{ secrets.GITHUB_PERSONAL_ACCESS_TOKEN }}
          workflow_file_name: 'tests.yml'
          ref: master

which will trigger repo #2 every time something is pushed to master (merge?)

  • Related