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

Incorrect workflow_id when 2 matrix jobs triggers trigger-workflow-and-wait at the same time #61

Open
hpsony94 opened this issue Sep 27, 2022 · 7 comments

Comments

@hpsony94
Copy link

hpsony94 commented Sep 27, 2022

Hi guys,

I am facing this issue in this context:
For instance, I have 2 repositories such as

  • github.com/example/main (main repo)
name: master ci
on:
  push:
    branches:
      - 'master'
jobs:
  build_ci:
    name: build_ci
    steps:
      - run: echo "master ci"
  run_e2e:
    name: run_e2e
    strategy:
      fail-fast: false
      matrix:
        target: [test01, test02]
    needs: build_ci
    steps:
      - uses: convictional/trigger-workflow-and-wait@v1.6.3
        name: trigger ${{ matrix.target }} and wait for it
        with:
          owner: ${{ github.repository_owner }}
          repo: test
          github_token: ${{ secrets.GH_DISPATCH_TOKEN }}
          workflow_file_name: dispatch_ci.yml
          ref: master
          wait_interval: 10
          client_payload: '{"testsuite":"${{ matrix.target }}"}'
          propagate_failure: true # Fail current job if downstream job fails.
          trigger_workflow: true
          wait_workflow: true

  • github.com/example/test (test repo)
name: Dispatch CI
on:
  workflow_dispatch:
    inputs:
      testsuite:
        description: 'a Set of test cases'
        required: true
        default: 'test01'
        type: choice
        options:
        - test01
        - test02

jobs:
  dispatch-ci:
    name: run ${{ inputs.testsuite }} test
    runs-on: ci-general
    if: github.ref == 'refs/heads/master'
    steps:
      - uses: actions/checkout@v3
      - name: return random for testing purpose
        run: |
          sleep 5

The dispatch-ci job in Dispatch CI workflow has been triggered via the change of master branch in the main repo.

But the thing is that it triggered it successfully but the result of checking the dispatch-ci job is incorrect.

After reading the code, I realized that there are 2 points

  • Github action returns 204 with no content in case of calling worklows/dispatches. I have tried locally, and it returns 204No Content
  • For the first point, trigger_workflow() func is implemented by comparing old and new run ID which lead to some mistakes in case of multiple triggers at the same time.

I'd like to raise this issue for further discussion to find alternative solutions which we can contribute wherever in this actions plugin or Github actions API ....

@matt-vendia
Copy link

Having the same problem when kicking off 2 remote actions at the same time in the same target repo. Both source actions are completing when one of the target actions completes. Going to try delaying invocation on one action to see if that works as a stop-gap.

@a-chatterjee
Copy link

Facing the same issue.

@chicocvenancio
Copy link

We're also facing this issue.

@mattthaber
Copy link

this repo seems unmaintained at this point. might just fork and fix this issue

@oleksandr-ivanov-ah
Copy link

I'm also facing the same issue

@xnap
Copy link

xnap commented Feb 2, 2024

same

@henryjw
Copy link

henryjw commented Feb 9, 2024

If anyone else is facing this issue, I've implemented a workaround by using a run name that's unique enough per workflow. It's not a perfect solution, but it works for my use case.

The change is on tag 1.7.0 on my fork.
https://github.com/henryjw/trigger-workflow-and-wait#known-issues

Example
https://github.com/henryjw/workflow-trigger-test/commit/88082aa0e9cb4a45c79a14bd2353c83c7ee6ea1e

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

8 participants