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

pr-comment: Display artifacts for all workflows, not just the most recent finished one #23

Open
Calinou opened this issue May 27, 2021 · 3 comments

Comments

@Calinou
Copy link

Calinou commented May 27, 2021

We have a repository that has multiple workflows (one per target OS).

I've made some testing in my fork, but I noticed that the GitHub Actions bot will replace the artifact links whenever a workflow is completed for the pull request. This can be verified by checking the bot post's comment history on the above link:

image

Instead, I'd like new artifact links to be appended at the end.

Do you know if this is technically feasible? Also, can it work with commits that are amended and force-pushed (something that frequently happens on Godot pull requests)? Thanks in advance 🙂

PS: Thanks for maintaining nightly.link, it's proven useful to distribute offline HTML builds of the Godot documentation already ❤️

@oprypin
Copy link
Owner

oprypin commented May 29, 2021

Thanks for the message. I was holding off my reply until I investigate the details but that still hasn't happened, so...


You are correct that this happens. This script definitely isn't made to accept multiple workflow files. I actually didn't consider that situation at all.

For my purposes, I never separate workflows that have the same topic but just happen to run on a different OS. I think the philosophy for GitHub Actions should be to put workflows into as few files as technically possible. Because if at some point you realize that they need to be interdependent, that is actually achievable then.And yeah, if that's the setup then this just works.

Then, how to achieve this for multiple workflow files.The first thing to keep in mind is that this action reacts to any workflow finishing. It updates the comment every time there is a finish for any new commit in a PR. Which works perfectly when there's only one workflow file. While you're right that replacing the whole contents is wrong in that case, just plainly appending is also wrong, as it will gather all historic finishes. Though you could try to deduplicate them. Then we run into the fact that there's no such action as "appending" to a comment, so this would be rife with race conditions.


There's a whole another avenue to achieving this. That is to have one separate comment per workflow file, then each followup finish of a workflow could find its dedicated comment and update that. The downsides? Not many actually. Just the fact that you'll have a whopping 5 bot comments every time; coming at different times even.


So, while I'm sure that something can be done to achieve this, right now I don't see any solution that wouldn't hugely complicate this code.

Of course, you're welcome to experiment yourself, nothing is tied to this repo.

@oprypin
Copy link
Owner

oprypin commented May 29, 2021

Oh and let me know if any of these options sound acceptable, or what you're thinking, or whether this is really important to do right. Otherwise it's hard for me to judge how I should prioritize this.

@Calinou
Copy link
Author

Calinou commented May 29, 2021

Oh and let me know if any of these options sound acceptable, or what you're thinking, or whether this is really important to do right. Otherwise it's hard for me to judge how I should prioritize this.

Right now, I already wrote a documentation page on how to download artifacts from GitHub Actions for logged in users, but the UX for non-logged in users won't be great. One way to improve it could be to allow entering a repository branch URL in nightly.link, and then have nightly.link return links to download artifacts for all the workflows. For instance, I'd like to be able to enter an URL of the form https://github.com/godotengine/godot/tree/3.x and get links to all artifacts for all workflows in that branch. But I understand that may be a lot of work to implement.

Multiple comments will probably generate too many notifications and end up being an annoyance in the end, so I don't think it's a good solution. It would be great if GitHub let bots comment without notifying everyone watching the repository, but I doubt that'll happen.

Edit: In case anyone else is interested, here's the documentation page I wrote: godotengine/godot-docs#4946

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