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

Show 🎄 #1258

Closed
qstokkink opened this issue Jan 12, 2024 · 4 comments
Closed

Show 🎄 #1258

qstokkink opened this issue Jan 12, 2024 · 4 comments
Assignees
Labels
priority: medium Enhancements, features or exotic bugs

Comments

@qstokkink
Copy link
Collaborator

We have had extended unit tests run on validate since 4cf28ad, lovingly referred to as the "Christmas tree". 🎄

Initially, these tests were not added as a PR check, pending assessment of their stability.

By now, these tests are stable enough to detect issues (e.g., in #1257). However, they are not shown as a PR check, so the test results are hidden for the PR author.

We should modify .github/workflows/pr-comment-validate.yml to report its status on the corresponding PR.

@qstokkink qstokkink added the priority: medium Enhancements, features or exotic bugs label Jan 12, 2024
@qstokkink
Copy link
Collaborator Author

After a lot of digging (through repos and tutorials), I found https://github.com/marketplace/actions/github-status-action-v2 to set commit statuses. This action seems to (1) still be maintained and (2) able to set statuses based on our triggering event, which is:

on:
issue_comment:
types: [created]

However, the issue_comment event does not include the commit SHA to set the status for. Open problem: we have to somehow fetch that from the issue number.

Our current approach for the checkout action is to create a remote ref from the issue number. We should - probably - be able to dereference this (in a preceding step) and feed it to github-status-action-v2.

ref: refs/pull/${{ github.event.issue.number }}/head

@qstokkink
Copy link
Collaborator Author

I can't find any action to grab a SHA from a PR ref. We'll probably need a custom command and write it to an env var.

The command itself should be something like the following:

git ls-remote origin refs/pull/${{ github.event.issue.number }}/head | grep -o "^\w*\b"

The origin may also need to be determined from the issue_comment. We can try to see if it works without that.

Whatever it may end up looking like: we can then set the env var and feed it to github-status-action-v2. This should be enough info to start the implementation.

@qstokkink
Copy link
Collaborator Author

Lesson learned: env vars can only be used within the steps of a single job. To communicate output of jobs between jobs we need to write to $GITHUB_OUTPUT instead of $GITHUB_ENV (https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs).

@qstokkink
Copy link
Collaborator Author

🎉 The results are now visible in the PR, this issue is resolved.

screenshots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Enhancements, features or exotic bugs
Development

No branches or pull requests

1 participant