ci: Fix lint check status update#2224
Conversation
The lint workflow is not important for this PR, but a fixed requirement to pass for merging. As this workflow is triggered by `schedule` or `workflow_dispatch`, it will not trigger other events such as `pull_request` for other workflows to respond to. Since the linting workflow is not important for this type of PR, we can pretend it was "skipped" and set the check status to "success". This is simpler than running the actual Lint workflow redundantly.
This didn't work out, reverting.
wernerfred
left a comment
There was a problem hiding this comment.
Woa there happened a lot in the like 8h i was not online 😄
I'm not sure if i would approve that. While it works and it is fine from a linting perspective in my eyes all that is a lot of workaround only because this one contributor workflow triggers a PR that cannot be linted.
Maybe we will find another solution/action das can create PRs in a different way? It might be okay in the meantime but we should look into different solutions imho for the near future. I don't like workflows that went from workaround to workaround. I mean, the contributors workflow has half of its LOC by deleting branches and pretending success for linting job.
What do you think?
|
If you view the discussion for the resolve link, I have detailed alternative solutions to trigger the lint workflow correctly, but I can't say that they're any better. If adopting the referenced
I don't see an issue with the approach proposed here. It's the simplest "fix", and it makes it clear that the check was skipped (remember that these check status will show "success" if a workflow skips internally IIRC?) via explicit message beside the check. If someone wants to resolve it a different way that's fine 👍 I just lack the time to put towards alternatives approaches. This should at least work in the meantime 😅 |
|
Not against it - don't get me wrong. Just my incentive to get it working like it should. I will see if i can reproduce this on my repo and if i will find a solution working without PAT,.. |
|
Because linting.yml is set in the repository settings as a mandatory check to run on every interaction. We could discuss on removing this but imho its good practice to force as many workflows as possible to run to cover all possible circumstances.
It is scoped to an individual person. Sadly there is no "organization PAT" available right now. |
|
I understand. What is the downside of "scoped to an individual person", beside it's ugly not having a org PAT? |
Mutiple issues here:
All in all i use PATs myself in a lot of actions (mostly to trigger other workflows, so exact same issue) bc it is the easiest way to archive things. But I am a single person and not a github org which is the biggest difference in terms of security and responsibilities. Maybe it will turn out that the PAT flaws are smaller than the benefit we gain on using them and we stick with them. Experience will show. As mentioned earlier i will try to rebuild the environment/setting in my scope and see if i find a solution that "works" but it will take some time. |
So in the meantime, we merge this one or should we wait? |
|
Merge it in the meantime. Lets See If it is working. |
|
PAT will also make the action/workflow appear to be performed by you. Eg, we won't have a bot opening the PR, it'll be your account. With the SSH deploy keys you can make this work with the bot IIRC, and it allows better restricting the scope of permission to single repo. I can't recall how the Github App generated tokens compare, but if you follow that link I provided it covers all pro/cons well. If you'd like an example of using SSH Key deployment, I came across this AWS project PR which implements it, could be good reference? I also advise looking into that |
|
This doesn't seem to work, see here
|
It should... On my system: In the action the step gets the hash and sets it to an output variable correctly AFAIK: id: commit-data
run: 'echo "::set-output name=head_sha::$(git rev-parse contributors-update)"'Although the workflow report you linked shows this error output for that command: Is this branch not locally available at the time the command is run? I thought you had checked out the repo and created the branch with a commit pushed in the earlier steps? I unfortunately don't have time to setup a throwaway repo to iterate on this workflow so that the required info is available. Running either of the two commands I showed above, but giving an invalid branch name results in the same error output, so I'm rather positive that's the cause of the failure. I can create another PR to add a step that I think would resolve it: docker-mailserver/.github/workflows/docs-production-deploy.yml Lines 80 to 84 in 7b4ce69 That does a shallow checkout of the |
|
The current workflow earlier steps: docker-mailserver/.github/workflows/contributors.yml Lines 21 to 34 in 7b4ce69 Looks like it checks out master branch, then creates the I am reminded that a PR also has a "merge" commit that's separate from the PR commits which is to provide the diff from the PR and the target branch, this isn't publicly viewable as a commit IIRC, but I do recall the preview docs workflow when testing different configs could target that and add comments to it like any other commit. I'm not sure if this special type of PR commit has relevance to the check status, I don't think it does.. just mentioning it if it turns out I'm mistaken about the correct commit SHA to retrieve. |
That was the problem 👍 |
|
I was writing a response and doing some investigation, then decided I could put out a PR again for this workflow (just not properly test it unfortunately). Looks like you bet me to it with a PR though 😅 Old WIP messageIf I understand the contributors action correctly, it will commit the update locally and you must push it yourself afterwards? (unless using the create PR feature): The branch We should be able to fix this by changing the branch to refer to the HEAD with |
|
The |
Description
The lint workflow is not important for this PR, but a fixed requirement to pass for merging.
As this workflow is triggered by
scheduleorworkflow_dispatch, it will not trigger other events such aspull_requestfor other workflows to respond to. The earlier attempt was partially successful, the lint workflow did run, but it incorrectly associated the lint workflow run to the latest commit onmasterbranch.Since the linting workflow is not important for this type of PR, we can pretend it was "skipped" and set the check status to "success". This is simpler than running the actual Lint workflow redundantly, which would require
workflow_dispatchevent triggering AFAIK to do correctly, but that has additional auth constraints via token requirements.Resolves: #2218
Type of change
Checklist: