[WIP] ci: attach commit status to PR for issue_comment triggers#389
[WIP] ci: attach commit status to PR for issue_comment triggers#389alexxa wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
So the problem I had was pure PEBCAK - I subconciously interpreted the One option that came to my attention is that maybe this could be triggered by adding a functional-tests label The advantage of that is you can do: Then check If we can't do that - is it possible to use the "checks" API rather than the "status" API? This would probably result in a more consistent and easy to understand output. Assuming that we need to use the API in some way, I'm not really a fan of extending the use of mixed/python shell like this - it's hard to read, and multiple levels of quoting and interpolation make it more error prone. Let me throw out some options here - maybe one of them works and is appealing:
|
78d1c59 to
e4a167b
Compare
| core.setOutput('GIT_URL', gitUrl); | ||
| core.setOutput('GIT_REF', gitRef); |
There was a problem hiding this comment.
I think you can do core.setEnvironment('GIT_URL', gitUrl) end skip setting them in the subsequent env: block.
| if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" != "functional-tests" ]]; then | ||
| AUTHORIZED=false | ||
| elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'functional-tests') }}" == "true" ]]; then |
There was a problem hiding this comment.
This wasn't quite my suggestion - it looks like you've implemented here that the functional-tests label as a gate on the other ways of triggering it on the pull request - so the tests aren't run initially even for a an authorized user, but once an authorized user has added the label the tests are run and any further updates to the PR cause the tests to run..
(Does allow an external contributor to create a trojan-horse PR that is initially fine, but on update does whatever we are trying to avoid happening by requiring approval?)
What I was suggesting is more hacky, but also simplifies things more radically. I was suggesting that adding the functional-test labels could be a replacement for /retest / /functional-tests. To allow repeated triggering, the action would immediately remove the label again. (The automatic triggering for authorized users would still be there.
This could allow completely dropping the issue_comment path, and the complexities it causes. It's not very discoverable, but neither is adding magic comments.
As demonstrated on PR #388 , PR comments starting with
/retestand/test-functionalwithout any other wording in front including spaces trigger Functional Tests workflow (see the screenshot attached).By default, it's not visible within PR page. Workflows triggered by issue_comment run in the context of the default branch, not the PR. Because of this, GitHub does not automatically attach the workflow run to the PR's 'Checks' UI at the bottom of the page. One needs to go to 'Actions' to see it.
This PR adds the issue_comment run to show up at the bottom of a PR with a green checkmark/red X.
Yeah, it looks unusual to have a block of Python embedded in the middle of a Bash script inside a YAML file, but it feels like a reasonable workaround to communicate with the GitHub API from inside a container that lacks standard CLI networking tools like curl.
A kind reminder: just like the
--xunitfix, this enhancement will only start functioning after it is merged into the main branch.