workflow: generate PR comments when non-required tests fail and let the action itself succeed #1016
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prologue
A while ago I attempted to do this thing, made a mess, and gave up.
Now, I am happy to report that with a little distance and time, I realised I was being, as @mvo5 would say, a Muppet.
This PR changes the osbuild-composer integration check workflow.
Current workflow
Currently, we have a test that checks if the HEAD of a given PR breaks osbuild-composer compatibility. This test is not required for merging, but is meant to serve as a warning that compatibility with osbuild-composer is either already broken or will be and that some work will be required to update the dependency. This is a good thing to know and kudos to @thozza for introducing it.
However, there's a couple of things about the current workflow that proved to be a bit annoying in the long run:
New workflow
The new workflow doesn't fail if the integration test fails. Instead it posts a message notifying the author and reviewers of a PR that compatibility/integration with osbuild-composer will fail when the dependency is updated. This message is only posted on a PR that causes the incompatibility issue. If compatibility is already failing on the merge base of the PR (i.e. on main), the notice is not posted.
As an extra bonus, if a message is posted due to breakage, and the same PR is updated to fix the issue, the comment is edited to reflect that it has been fixed.
The comment in the workflow file itself explains how things work in more detail.
Message wording
Suggestions about the wording or any extra information you'd like to see in the comments are more than welcome.
Example repo
While working on this, I created a clone of this repository to experiment with everything I wanted to do and get the workflow just right. In the repo there are three open PRs: