-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Action to auto-comment on pull requests with a link to the artifact #5539
Conversation
Whenever a CI build for a pull request succeeds, `github-actions[bot]` will comment (or edit the comment) with a link to directly download the artifact (i.e. the APK) from it. The bot's comment will tend to be near the start of the thread. The service https://nightly.link/ is used for the actual link because it allows downloads without logging in. It is possible to make an equivalent link directly to GitHub, but users who happen to not be logged into GitHub will just get a 404 error. Why this can't be done more simply: * Running the comment API directly from the pull request's action can't be done due to permission boundaries. * [workflow_run](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_run) is the intended place for commenting actions, but GitHub really just doesn't provide a way to find the originating pull request from this event, so we have search for it through the SHA (and that basically takes up the top half of this). You can see what other hacks people have devised for this [here](https://github.com/nyurik/auto_pr_comments_from_forks) and [here](https://github.com/search?l=YAML&q=workflow_run+createComment&type=Code)
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.
I tested this and it works great! We should probably remove the APK testing section yet again in another PR.
Edit: I just have a minor comment; see below.
What are the stats/plans for uptime/relieability and co.
|
This is running on a VPS that goes down pretty much only for restarts. I am 100% sure that what's already here will stay free. And monetizing is not a goal. The mention of "actively searching for projects" and "scale" is a bit overstated. The traffic is tiny now and I'm pretty sure that even for a 1000x increase I won't need to do anything. If it somehow gets crazy popular, sure, bring on the challenge, I'll tackle it. The good thing is that it's very very easy to shard the traffic. Keeping this running long term is a matter of personal pride. While I say that traffic is low, it has certainly passed the threshold where I could just shut it down in good conscience. The costs to me are almost nothing. Yes, I'll just keep paying for the hosting indefinitely - easily more than 1 year. Worst case, you can delete and/or swap out all the links, so I'm not sure what there is to worry. |
On a separate note, as written at https://nightly.link/, someone would ideally "install the GitHub app" for the org. |
Anything holding this up? |
1 similar comment
Anything holding this up? |
Sorry for the late reply. There's just some internal discussion within the team regarding this PR right now. |
Welp, whenever you're ready, you're welcome to continue from https://github.com/oprypin/nightly.link/tree/master/.github/workflows |
What is it?
The issue
I first noticed that NewPipe has this issue via this comment (because I was globally searching GitHub for mentions of "https://nightly.link/", which is my project):
(Also see the next few comments after that one)
So here I'm basically fulfilling both parts of this need: I'm adding a "bot" (really it's isolated entirely within GitHub Actions for this repo) that automatically posts such a link to the APK from the pull request and the link works for guest users.
Description of the changes in your PR
Whenever a CI build for a pull request succeeds,
github-actions[bot]
will comment (or edit the comment) with a link to directly download the artifact (i.e. the APK) from it. The bot's comment will tend to be near the start of the thread.See an example of this in action here
The service https://nightly.link/ is used for the actual link because it allows downloads without logging in. It would be possible to instead make an equivalent link directly to GitHub, but users who happen to not be logged into GitHub will just get a 404 error.
Why this can't be done more simply:
APK testing
Well yes, APK testing is exactly what this improves, so this section will become unnecessary:
Due diligence
Note that I am not involved with NewPipe whatsoever, only popping in for this particular contribution, but I intend to always follow up on anything relating to it (you can always @ me or find me on IRC).