Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflows not triggering when there are multiple repositories #184

Closed
neverkas opened this issue Mar 22, 2023 · 2 comments
Closed

Workflows not triggering when there are multiple repositories #184

neverkas opened this issue Mar 22, 2023 · 2 comments

Comments

@neverkas
Copy link

neverkas commented Mar 22, 2023

Hi, I'm trying to use an repository which receives the same event from different repositories. What I don't understand it's why it works with a repository (A) and it doesn't work if I've the same configuration in a repository (B).

This is my subtree repository on listen-dispatch.yml

# listen-dispatch.yml file 
name: listen trigger events from another repository

on:
  repository_dispatch:
    types: [update-subtree-repository]

jobs:
  build:
    name: run-workflow
    runs-on: self-hosted
    steps:
      - name: Checkout project
        uses: actions/checkout@v3
        with:
          ref: master
          fetch-depth: 0
      - name: Create environment variables
        run: |
          echo "REPOSITORY_NAME=`basename ${{ github.event.client_payload.repository }}`" >> $GITHUB_ENV
          echo "REPOSITORY_URL=git@github.com:${{ github.event.client_payload.repository }}.git" >> $GITHUB_ENV
      - name: Get changes
        run: make git-subtree-pull REPOSITORY_NAME=${{ env.REPOSITORY_NAME}} REPOSITORY_URL=${{ env.REPOSITORY_URL }}
      - name: update changes
        run: make upload-changes-to-remote

This is what I've on my repositories which send the event to the previous one, there's one of them which works though there is another one which has the same configuration and share the access token from the same organization, both are private repositories.

# repository-dispatch.yml file on multiple repositories from the same organization which share the same PAT
name: trigger events in another repository

on:
  push:
    branches: [ master ]

jobs:
  testing-trigger:
    runs-on: self-hosted
    steps:
      - name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v2.1.1
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          repository: myorg/mysubtree-repo
          event-type: update-subtree-repository
          client-payload: '{ "repository": "${{ github.repository }}" }' # optional, default is {}
@peter-evans
Copy link
Owner

Hi @neverkas

It doesn't sound like you are doing anything wrong so I don't see any reason why it shouldn't work. If the access token is stored at the repository level, my only suggestion would be to double check it's correct by copy/pasting it again.

@neverkas
Copy link
Author

Hi @peter-evans thanks, it was my fault I've another access token at repository level as you said. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants