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

Using latest 2.1.2 - workflow triggers twice. #272

Closed
LaithDaman opened this issue Oct 9, 2023 · 6 comments
Closed

Using latest 2.1.2 - workflow triggers twice. #272

LaithDaman opened this issue Oct 9, 2023 · 6 comments

Comments

@LaithDaman
Copy link

LaithDaman commented Oct 9, 2023

Hello, this is my first time using this 'peter-evans/repository-dispatch' based on following examples (see links below).

When I tried this 'peter-evans/repository-dispatch', I noticed the workflow is triggered twice:
One with 'Reusale Workflow' and another one with my name. The 'Reusale' one gets stuck but the other one finishes. See attached file for "Output", "File 1" - caller, and "file 2" callee.

I can appreciate the help or root cause for this problem, or what am I missing.
Both repos are on private network and valid secrets.pat works 100%.

Links:
Following: https://stevenmortimer.com/running-github-actions-sequentially/
Example: https://github.com/StevenMMortimer/salesforcer/tree/main/.github/workflows
API: https://github.com/marketplace/actions/repository-dispatch
Other example
(1) https://cloud-native.devsecopsgirl.in/deployment/

issue_peter_evans_repository_dispatch.txt

@peter-evans
Copy link
Owner

Hi @LaithDaman

I had a look at the attached text file. It looks like you are using self-hosted Actions runners, so that might be related to the problem. Please check that the runners are setup correctly and they can reach GitHub's API. It might be a good idea to test your setup with hosted runners first, to check it works before trying to use your own runners.

I don't see anything obvious as to why it would trigger twice.

@LaithDaman
Copy link
Author

Hi @peter-evans
Thank you for the quick response. The self-hosted work 100% and manually tested using the 'workflow_dispatch'.

I removed it from yml file since as I wanted a single point of entry (this may have been the root cause for triggered twice).

I applied your suggestions: I used 'ubuntu-latest' for both yml files (caller and callee).
The twice triggering is not longer there. But the issue still remains about callee workflow hangs.

Requested labels: EC2AMAZ-EVN2U58
Job defined at: _company_/EarthSlide/.github/workflows/reusable_workflow.yml@refs/heads/master
Waiting for a runner to pick up this job...

@peter-evans
Copy link
Owner

Sounds like the double triggering is fixed. 👍

Waiting for a runner to pick up this job...

This is nothing to do with this action. This is suggesting that it's waiting for a runner to pick up the job. It's an issue to do with self-hosting.

@LaithDaman
Copy link
Author

LaithDaman commented Oct 9, 2023

Hi @peter-evans
As I mentioned earlier; I have updated the code to run on 'Ubuntu-latest' and it is not using self-hosting. Both files changed from Self-Hosting to 'Ubuntu-latest' as you have suggested. Maybe I did not clearly understand what you mean then.

runs-on: ubuntu-latest # [ EARTHSLIDE_LAITHD_LOCAL ]

Do I take it that 'peter-evans/repository-dispatch' does not work or is not tested on self-hosted machines? The problem of this lib triggering two workflows using self-hosted is still an issue.

@peter-evans
Copy link
Owner

Do I take it that 'peter-evans/repository-dispatch' does not work or is not tested on self-hosted machines?

No, I think it should run on self-hosted machines just fine. There are thousands of users using this action and I would be very surprised if none of them are using self-hosted.

My point was, if you are seeing this message Waiting for a runner to pick up this job.. it means that GitHub actions is waiting for a self-hosted machine to pick up the job. So perhaps you didn't properly switch to GitHub hosted for your test. This message has absolutely nothing to do with this action, it's generated by GitHub's platform because it can't find a runner to execute the job.

@LaithDaman
Copy link
Author

I figured out what was wrong, another yml file workflow had "repository_dispatch:" without any guard condition. Hence it was triggering two workflows (with guard condition as expected and without).

It works flawlessly now. Thank you.
Regards

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