-
Notifications
You must be signed in to change notification settings - Fork 352
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
Infrastructure: Use markdown to format PR comments containing regression test coverage reports #1562
Conversation
|
Whoops well that didn't work -- will have to investigate! |
@@ -29,7 +29,7 @@ jobs: | |||
github-token: ${{secrets.GITHUB_TOKEN}} | |||
script: | | |||
const fs = require('fs'); | |||
const commentBody = '```' + fs.readFileSync('coverage.log', 'utf8') + '```'; | |||
const commentBody = fs.readFileSync('coverage.log', 'utf8'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue you're running into is that this change won't show up till this PR lands, because it is using pull_request_target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code fence was just my hacky way of dealing with the whitespace collapsing on the original format, but your other changes should address that
@@ -1,7 +1,7 @@ | |||
name: Regression Tests Coverage Report | |||
|
|||
on: | |||
pull_request_target: | |||
pull_request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the pull_request_target
, I don't think it has access to the Secret needed to post/update the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, of course, oh well -- I'll drop that commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to test it, you can push the updated Yaml to your own master branch in your fork (or change your default branch to this branch) and open a PR on your repo. You'd need to to add your own PAT as a GitHub secret too
Actual steps I needed do:
- Setup the
GH_TOKEN
secret on https://github.com/nschonni/aria-practices/settings/secrets, but I actually already had it from the gh-pages deploy testin - Pushed your branch to my fork
- Pushed a commit, with just the removal of the code fence to my default branch nschonni@cb9183c
- Open PR from your branch to my default, so it would include your fixed up rendering in the script, but triggered the workflow in main.
- Profit Switch the regression report to use markdown nschonni/aria-practices#40 (comment)
None of that is required for changes here, just if you want to iterate on the styling on your own fork
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for detailing I'm sure I'll want to test the actions like this in the future!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or if you don't want to over-think it, like apparently did, just edit the bot comment after it's created/updated and remove the backticks manually 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hahaha omg why didn't we think of that 👀
03f74df
to
85b8ebe
Compare
@spectranaut here's how it looks nschonni#40 (comment) |
console.log(missingTestIdsReport || 'None found.\n'); | ||
|
||
console.log('SUMMARTY:\n'); | ||
console.log('### SUMMARTY:\n'); | ||
console.log(' ' + exampleFiles.length + ' example pages found.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whitspace padding gets lost, so it can probably get dropped here and the lines below. Not sure if \t
would work instead if the indent should be kept
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That white space padding is not super important, it was just ot make the console output more readable and less of a wall of text. In this context I think it's totally fine!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random though, you could just make these 2 items a list
Pulling the comment from @carmacleod from my test PR nschonni#40 (comment)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! Some very simple changes to make.
test/util/report.js
Outdated
@@ -260,14 +260,15 @@ fs.readdirSync(testsPath).forEach(function (testFile) { | |||
} | |||
}); | |||
|
|||
console.log('\nExamples without any regression tests:\n'); | |||
console.log('\n## Regression test coverage:\n'); | |||
console.log('\n### Examples without any regression tests:\n'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make level 4 headings for all the headings. The GitHub comments themselves have level 3 heading, and we want these to be subheadings.
console.log(missingTestIdsReport || 'None found.\n'); | ||
|
||
console.log('SUMMARTY:\n'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix spelling of summary
Fixed! Thanks of the feedback everyone. @carmacleod -- I tried to be a bit more clear, but the "Keyboard support" table and the "Role, Property, State, and Tabindex Attributes" table should have have "data-test-id" attributes on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Thanks @nschonni and @spectranaut !
Someone with permissions on this repo could edit the bot comment above to remove the backticks if you want to see what the end result will look like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Now that we have a github action to add a comment with the regression coverage report we can take advantage of markdown formatting and format the report appropriately.