Skip to content

github: add support for Hacktoberfest using labels#7897

Merged
mback2k merged 1 commit intocurl:masterfrom
mback2k:master
Oct 27, 2021
Merged

github: add support for Hacktoberfest using labels#7897
mback2k merged 1 commit intocurl:masterfrom
mback2k:master

Conversation

@mback2k
Copy link
Copy Markdown
Member

@mback2k mback2k commented Oct 23, 2021

Sorry for being a little late with this, but I finally got to implementing the necessary workflows and successfully tested them in my curl repository fork with a fake "hacktoberTest" set of labels.

If this PR is accepted/approved for merge, I will also go ahead and retroactively add the labels to all relevant PRs for this years Hacktoberfest once via the GitHub CLI.

--

Automatically add hacktoberfest-accepted label to PRs opened between
September 30th and November 1st once a commit with a close reference
to it is pushed onto the master branch.

With this workflow we can participate in Hacktoberfest while not
relying on GitHub to identify PRs as merged due to our rebasing.

Requires hacktoberfest-accepted labels to exist for PRs on the
participating repository. Also requires hacktoberfest topic on
the participating repository to avoid applying to forked repos.

Fixes #7865

@mback2k mback2k requested a review from bagder October 23, 2021 09:58
@mback2k mback2k self-assigned this Oct 23, 2021
@mback2k
Copy link
Copy Markdown
Member Author

mback2k commented Oct 23, 2021

Workflow "Hacktoberfest / opened (pull_request)" is failing right now, because the labels need to be created manually ahead of time. Once @bagder approves, I will also do that and re-run the workflow accordingly.

@bagder
Copy link
Copy Markdown
Member

bagder commented Oct 23, 2021

Add hacktoberfest label to opened PRs between September 30th and November 1st for easier identification in acceptance step.

Do all PRs opened in October get this label automatically?

@mback2k
Copy link
Copy Markdown
Member Author

mback2k commented Oct 23, 2021

Add hacktoberfest label to opened PRs between September 30th and November 1st for easier identification in acceptance step.

Do all PRs opened in October get this label automatically?

Yes, indeed. That is what the failing task mentioned above would do.

@mback2k
Copy link
Copy Markdown
Member Author

mback2k commented Oct 23, 2021

Updated to avoid affecting forks and creating a failed GitHub status entry for those.

@jay jay added the CI Continuous Integration label Oct 23, 2021
mback2k added a commit to mback2k/curl that referenced this pull request Oct 23, 2021
1. Add hacktoberfest label to opened PRs between September 30th
   and November 1st for easier identification in acceptance step.

2. Replace hacktoberfest label with hacktoberfest-accepted label
   on PR once a commit with a Closes/Merges reference to it is
   pushed onto the master branch.

With these two steps we can participate in Hacktoberfest while not
relying on GitHub to identify PRs as merged due to our rebasing.

Requires hacktoberfest and hacktoberfest-accepted labels to exist
for PRs on the participating repository. Also requires hacktoberfest
topic on the participating repository to avoid affecting forks.

Fixes curl#7865
Closes curl#7897
@mback2k
Copy link
Copy Markdown
Member Author

mback2k commented Oct 23, 2021

I am sorry for the many force-pushes. I had to be sure the repository check is working correctly, now it does.

@bagder
Copy link
Copy Markdown
Member

bagder commented Oct 23, 2021

I think this risks being highly annoying since the vast majority of our pull-requests will not be hacktoberfest material, but I'm willing to try it out. Can we get any feedback if any of the labelled PRs is actually eventually used to claim something? To use as feedback if we're going to try this again next year or not I mean.

@bagder
Copy link
Copy Markdown
Member

bagder commented Oct 25, 2021

@MattIPv4 we're only interested in how many claims there are on PRs on curl, we don't care about exactly which nor who did them. I personally suspect the amount is very close to zero, which makes all our efforts on bending backwards to comply totally wasted.

@MattIPv4
Copy link
Copy Markdown

we're only interested in how many claims there are on PRs on curl, we don't care about exactly which nor who did them.

I will ask our legal folks if that's a number we can share 👍

I personally suspect the amount is very close to zero, which makes all our efforts on bending backwards to comply totally wasted.

I'm not sure why you make this out to be such a big pointless effort on your end, it's just adding a label to some PRs (admittedly, through some automation instead of just by hand), but if you don't want to do it then don't do it? Y'all can remove the topic and not participate if you want to...

@bagder
Copy link
Copy Markdown
Member

bagder commented Oct 25, 2021

I'm not sure why you make this out to be such a big pointless effort on your end,

Because I think hacktoberfest needlessly complicates things for (projects working like) us and that I believe we don't have much participation anyway, but we have contributors who still think we should participate. I'm willing to be proved wrong.

@vszakats
Copy link
Copy Markdown
Member

vszakats commented Oct 26, 2021

Is there a way to opt-out a specific PR or a whole (own) username from participating in this? (My concern is that email addresses will be automatically submitted-to/collected-by the organizer, which may be undesirable for some.)

@mback2k
Copy link
Copy Markdown
Member Author

mback2k commented Oct 26, 2021

I guess that would have to be done on their side, because they scan all PRs anyway since approval or merge also counts as participation and that happens even without my changes. At least every approving review triggers a PR to be accepted until it is then closed by our way of merging.

I would think that they ignore your submission unless you explicitly signed up for Hacktoberfest. Pinging @MattIPv4 about this again.

@mback2k
Copy link
Copy Markdown
Member Author

mback2k commented Oct 26, 2021

Also the way I implemented this, it relies on an additional label hacktoberfest which is set between a PR being opened during the event timeframe and it being closed. You could then just remove the hacktoberfest label while the PR is open. That way it won't get the relevant hacktoberfest-accepted label on closure.

@bagder I guess that is a good reason for keeping the proposed approach as well.

@bagder
Copy link
Copy Markdown
Member

bagder commented Oct 26, 2021

I would think that they ignore your submission unless you explicitly signed up for Hacktoberfest

A submission surely needs some sort of active action by the person asking? If I want a hf tshirt I need to go there, register myself and post links/identifiers to the PRs that I claim qualify, don't I?

From what I know, @mback2k is the only person who ever participated in hacktoberfest with curl contributions.

I guess that is a good reason for keeping the proposed approach as well.

Well, it would be as easy to remove the hacktoberfest-accepted label as it is to remove the hacktoberfest one. The -accepted one has the benefit that it is never set on an open PR, while the latter will "spam" open PRs.

@MattIPv4
Copy link
Copy Markdown

I would think that they ignore your submission unless you explicitly signed up for Hacktoberfest. Pinging @MattIPv4 about this again.

Correct, we only fetch PRs for users that've actively signed up to Hacktoberfest.

@mback2k
Copy link
Copy Markdown
Member Author

mback2k commented Oct 26, 2021

I guess that is a good reason for keeping the proposed approach as well.

Well, it would be as easy to remove the hacktoberfest-accepted label as it is to remove the hacktoberfest one. The -accepted one has the benefit that it is never set on an open PR, while the latter will "spam" open PRs.

Okay then. I just reworked this PR to just require the hacktoberfest-accepted label on PR closure/merge. The hacktoberfest topic just needs to be set on the repository to enable this workflow (to avoid affecting forks), but not on the individual PRs anymore. @bagder what do you think of this now?

@bagder
Copy link
Copy Markdown
Member

bagder commented Oct 26, 2021

I approved it already before this change 😄

@mback2k
Copy link
Copy Markdown
Member Author

mback2k commented Oct 26, 2021

Thanks @bagder. Can I then ask you to re-add the hacktoberfest topic label to the repository before I merge this PR?

@bagder
Copy link
Copy Markdown
Member

bagder commented Oct 26, 2021

done!

Automatically add hacktoberfest-accepted label to PRs opened between
September 30th and November 1st once a commit with a close reference
to it is pushed onto the master branch.

With this workflow we can participate in Hacktoberfest while not
relying on GitHub to identify PRs as merged due to our rebasing.

Requires hacktoberfest-accepted labels to exist for PRs on the
participating repository. Also requires hacktoberfest topic on
the participating repository to avoid applying to forked repos.

Reviewed-by: Daniel Stenberg

Fixes curl#7865
Closes curl#7897
@mback2k mback2k closed this in f0ab8a6 Oct 27, 2021
@mback2k mback2k merged commit f0ab8a6 into curl:master Oct 27, 2021
mback2k added a commit that referenced this pull request Oct 27, 2021
Follow up to #7897

Test references to see if permissions are now sufficient:

Closes #7832
Closes #7897
@mback2k
Copy link
Copy Markdown
Member Author

mback2k commented Oct 27, 2021

I don't know why, but for some unknown reason I had to do this follow-up commit to make it work on this repository:
80450f8

In my own repository it worked like a charm, but it seems like if you push to a repository that does not belong to your own account, the GITHUB_TOKEN is limited or restricted by default. See also Permissions for the GITHUB_TOKEN.

@MattIPv4
Copy link
Copy Markdown

🤔 This PR shows as merged: https://api.github.com/repos/curl/curl/pulls/7897

@MarcelRaad
Copy link
Copy Markdown
Member

This PR shows as merged

Yes, that's what happens when you merge exactly the commit in the PR without rebasing.

mback2k added a commit to mback2k/curl that referenced this pull request Oct 27, 2021
Unfortunately the GitHub API requires a token with write permission
for both issues and pull-requests to edit labels on even just PRs.

Follow up to curl#7897
@jay
Copy link
Copy Markdown
Member

jay commented Nov 3, 2021

This appears to be working except I notice #7944 wasn't tagged. Should it have been?

@mback2k
Copy link
Copy Markdown
Member Author

mback2k commented Nov 3, 2021

No, that PR wasn’t created/opened in or 1 day around of October.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration

Development

Successfully merging this pull request may close these issues.

hacktoberfest topic incompatible with manual PR merging

6 participants