-
Notifications
You must be signed in to change notification settings - Fork 49
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
Do not run the 'dependency-submission' job in CI for forked repositories #720
Do not run the 'dependency-submission' job in CI for forked repositories #720
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This is something I've thought about doing before. We have a similar problem not just with dependency submission but also with publishing: forks also attempt to publish even though their credentials are not setup correctly. So we should also consider fixing that in a similar way.
Although this solution works well for CI, the reason I've hesitated to implement it before is because it requires that the developer's local git repository is correctly configured with the upstream
remote. Unfortunately, this does not happen automatically: if you fork a repo on GitHub and then git clone
it locally, the upstream
will not be configured and until you do so you will not be able to properly generate workflows.
Thoughts?
"github.event_name != 'pull_request'" | ||
)(repo => s"github.repository == '$repo' && github.event_name != 'pull_request'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move the event_name
condition into a constant so we don't have to duplicate it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it makes sense 👍🏻
Oh, I see. Several thoughts:
|
Thanks for thinking about it!
Is this trade-off worth it? I guess the question I'm wondering is, what is the harm of this failed CI job on forked repositories? We already have failed CI for publishing as well. Also, if it really bothers users, why don't they take the "one-time action" to enable Dependency Graph for their repository? Wouldn't that solve the problem? |
There seems to be some confusion when we talk about 'users.' From my perspective, a typical user of sbt-typelevel is a maintainer of an affiliate project. In 99% of cases, these users are the ones who set up CI workflows in their projects. We can reasonably expect them to have decent skills in a wide range of areas, such as setting up a local git repository. On the other hand, there are users of these affiliate projects. These users are more likely to focus on new features, bug fixing, and enhancing documentation in their typical contributions, rather than adjusting the CI workflow. However, these users might encounter confusion in their forks when running CI workflows. To sum up: |
Ah yes, I see your point. I agree. I do have one last idea, that would make workflow generation independent of the git repository configuration, by using a condition like this: if: github.event.repository.fork == false I think what we should do is serialize this as a setting e.g. WDYT? |
If you argue that this approach feels better, it's okay with me. I'd like to have that issue resolved, no matter the path we take. |
@armanbilge by the way, If I understand things correctly, your suggested solution won't handle the case when the affiliate project is a fork. |
968d6ab
to
6700973
Compare
By default, no, it would not handle that case. That is why I suggested we implement it as a configurable setting:
Repositories that are maintained as forks are very unusual/rare. |
@armanbilge So, is there anything I need to address here to move on with this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry. I think your concern was legitimate, which is why I suggested we implement this as a setting #720 (comment).
Feeling dumb, but I altered the initial approach to align with your suggestions. So now we have a configurable setting with a reasonable default value 🤔 |
So sorry, I think I didn't explain very well. What I mean is that we should have |
Returning to this...
Wouldn't that |
Well, not any YAML, just a conditional expression. And we already accept an arbitrary string anyway. sbt-typelevel/github-actions/src/main/scala/org/typelevel/sbt/gha/WorkflowStep.scala Line 22 in e384990
Any plugin could always manipulate the |
6700973
to
7920f23
Compare
Okay, as I said, any solution would work for me if it resolves the original request. |
@armanbilge hey Arman, what's up? Is there anything else I need to polish to move forward with this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, just got a bit behind :) this looks good, thanks for adjusting!
This tries to fix the following issue in forked repositories:
Example: https://github.com/danicheg/cats/actions/runs/10027887278/job/27714122616#step:10:554