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

Run CI based on the check #297

Open
Aarsh2001 opened this issue Jul 30, 2022 · 7 comments
Open

Run CI based on the check #297

Aarsh2001 opened this issue Jul 30, 2022 · 7 comments

Comments

@Aarsh2001
Copy link

Can we run workflow files based on label checks?, if so, how?

@johnboyes
Copy link
Contributor

Hi @Aarsh2001, thanks for raising this. Can you elaborate a little please, and give me an example of what you would like to be able to do? Thanks.

@Aarsh2001
Copy link
Author

Aarsh2001 commented Jul 30, 2022

Sure, so i want my workflow files to run if there is a label present in the PR. So ideally i would like to first check if it is present, if it's true then run the jobs else skip.

Since, i was using label:actions, i found that it required for me to add a label for every commit in the PR. It triggered only once, when the label was added , it didn't trigger for the next commit, unless it was added again.

In such a case, i wanted the label checker to check if the label is present and then run the jobs. Hope this clarifies?

Maybe i could create another workflow file which checks for labels, and then add the result of this as a dependency in other workflows? i don't know😅

@johnboyes
Copy link
Contributor

That helps to clarify, thanks. A couple of initial questions/comments:

Feel free to come back if I've misunderstood!

@johnboyes
Copy link
Contributor

johnboyes commented Jul 30, 2022

Thinking about it more, I guess your use case is to have something very similar to this repo's label-checker, but which (instead of checking PRs) is a conditional that can be used inside a workflow to determine if the rest of the workflow should run. That's an interesting idea if so, which raises the question of whether this label-checker could/should be extended to offer that. My initial thoughts are that it would be best being a separate repo, as I'm a fan of the "do one thing and do it well" principle. Thoughts?

@Aarsh2001
Copy link
Author

Yes, you got it right. Also that we can create one workflow which checks for labels, and make other workflows depend on it, this worked in my case. I used the label-checker.yml and if it was a success other workflows ran. You can add this to the readme of the project maybe, as tricks and tips.😅

@johnboyes
Copy link
Contributor

Nice! Is your repo public? Please share the link to the commit when you've implemented this if so, will be v useful to have a working example I can reference in the README 👍🏻. If it's not a public repo then grateful if you can share a (sanitised) code snippet here, thanks 🙏🏻

@Aarsh2001
Copy link
Author

Yes the repository is public, I'll share it after the implementation 🙂, also the code snippet!

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