Skip to content

Fix: Always run annotation check for PRs#87

Merged
glx22 merged 1 commit intoOpenTTD:mainfrom
glx22:always_check_annotation
Jan 7, 2025
Merged

Fix: Always run annotation check for PRs#87
glx22 merged 1 commit intoOpenTTD:mainfrom
glx22:always_check_annotation

Conversation

@glx22
Copy link
Copy Markdown
Contributor

@glx22 glx22 commented Jan 7, 2025

Annotation check is skipped if any of the needed tasks fails.
image

And the required status is waiting for report.
image

Always run the check for PRs.

@TrueBrain
Copy link
Copy Markdown
Member

Your description lacks a bit of motivation.. why do you want to run this check if the build obviously already failed? Worded differently: What value does it add?

Not saying it is a bad idea, but I am not seeing why the current setup is an issue, and what this PR solves :D

needs:
- build

if: always() && github.event_name == 'pull_request'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would now only run on PR, but currently it also runs after merge. Is that change intended?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rw-annotation-check.yml also use if: always() && github.event_name == 'pull_request', so using if: always() here should be enough.
Anyway that means it already only run on PR.

Copy link
Copy Markdown
Member

@TrueBrain TrueBrain Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so mostly the rw-annotation-check.yml is outdated, and that if condition should be moved up one. So that if condition doesn't actually do what we hope/think it does :) At least, the always() part there is pointless, if I get it right.

Maybe good to just remove the if statement in that workflow. Makes this PR more clear in its intentions, and also forces us to cleanup some other repos that wrongly don't have the if statement before using the rw-annotation-check.yml. If that makes sense :P (please check if it makes sense)

PS: it means these two if statements should remain as they are :) At least, I think :P

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scratch that: my suggestion, for this PR: replace the rw-annotation-check.yml below with the actual action directly (so the annotation-check). And leave the rw-annotation-check.yml alone for now.

There are three users of that rw-. I think we should fix them to work how they are intended (they miss the if statement), and switch to the annotation-check directly too, much like the other repos like OpenTTD, catcodec, ...

That way, all repos are the same again, with the least amount of effort :P My suggestion, feel free to look around yourself what you think is best. But this did get kinda messy :D

@glx22
Copy link
Copy Markdown
Contributor Author

glx22 commented Jan 7, 2025

If annotation check is always executed, it's possible to only set this check as required for a given reusable workflow.
It then allows to add/remove steps inside the reusable workflow (except the annotation check step of course), without needing to update "required" in callers.
We do that already with OpenTTD CI-Build, only annotation is required as it validates all other CI-Build checks.

@TrueBrain
Copy link
Copy Markdown
Member

If annotation check is always executed, it's possible to only set this check as required for a given reusable workflow. It then allows to add/remove steps inside the reusable workflow (except the annotation check step of course), without needing to update "required" in callers. We do that already with OpenTTD CI-Build, only annotation is required as it validates all other CI-Build checks.

Something for a description next time :D

Okay, I was missing some context to actually be able to review this PR. You might already gathered this, but for me it was hidden away in how GitHub executes these workflows.

It seems, from what I can gather, that reusable workflows only execute their uses: when their preconditions are met. So in the case of a need, that is evaluated first, before the uses is included, and executed. So if a uses contains another if statement, that isn't evaluated at the same time as the need is. But if you move the if one level up, so next to the need, it will be executed together.

This is a bit unexpected, as I expected the uses to be resolved first, which would mean the if that is inside the uses will be evaluated at the same time as the need. Bit annoying choice, this.

It also means a bunch of other repositories have their workflows wrong. The intention is that the annotation check only runs on Pull Requests, no matter what, if I get you right. But a lot of repos only uses the rw-annotation-check (which contains the correct if-condition), but will never be executed if any of their need entries fail. So we have a bunch of clean up to do in a bunch more repos, if we want to make this right :)

Took me longer than I would like to admit to understand what was going on; hopefully you already knew and just didn't write it down :P

@glx22 glx22 force-pushed the always_check_annotation branch from b18793a to af393b1 Compare January 7, 2025 20:54
@glx22 glx22 merged commit 560010a into OpenTTD:main Jan 7, 2025
@glx22 glx22 deleted the always_check_annotation branch January 7, 2025 20:57
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

Successfully merging this pull request may close these issues.

2 participants