Merge pull request #31649 from woocommerce/try/remove-some-test-label
Remove smoke test label on failure
This commit is contained in:
commit
8e98a7c1e3
|
@ -96,7 +96,9 @@ jobs:
|
||||||
await script({github, context})
|
await script({github, context})
|
||||||
|
|
||||||
- name: Remove label from pull request.
|
- name: Remove label from pull request.
|
||||||
if: always() && ${{ contains( github.event.pull_request.labels.*.name, format('run{0} smoke tests', ':')) }}
|
if: |
|
||||||
|
always()
|
||||||
|
&& contains( github.event.pull_request.labels.*.name, format('run{0} smoke tests', ':'))
|
||||||
uses: actions-ecosystem/action-remove-labels@v1
|
uses: actions-ecosystem/action-remove-labels@v1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -5,14 +5,22 @@ const resultsFile = path.resolve( __dirname, '../test-results.json' );
|
||||||
|
|
||||||
const buildOutput = ( results ) => {
|
const buildOutput = ( results ) => {
|
||||||
const { TITLE, SMOKE_TEST_URL } = process.env;
|
const { TITLE, SMOKE_TEST_URL } = process.env;
|
||||||
|
const resultKeys = Object.keys( results );
|
||||||
|
|
||||||
let output = `## ${ TITLE }:\n\n`;
|
let output = `## ${ TITLE }:\n\n`;
|
||||||
output += `**Test URL:** ${ SMOKE_TEST_URL }\n`;
|
output += `**Test URL:** ${ SMOKE_TEST_URL }\n`;
|
||||||
output += `**Total Number of Passed Tests:** ${ results.numTotalTests }\n`;
|
|
||||||
output += `**Total Number of Failed Tests:** ${ results.numFailedTests }\n`;
|
resultKeys.forEach( ( key ) => {
|
||||||
output += `**Total Number of Test Suites:** ${ results.numTotalTestSuites }\n`;
|
// The keys that we care about all start with 'num'
|
||||||
output += `**Total Number of Passed Test Suites:** ${ results.numPassedTestSuites }\n`;
|
if ( key.includes( 'num' ) ) {
|
||||||
output += `**Total Number of Failed Test Suites:** ${ results.numFailedTestSuites }\n`;
|
// match only capitalized words
|
||||||
|
const words = key.match( /[A-Z][a-z]+/g );
|
||||||
|
|
||||||
|
output += `**Total Number of ${ words.join( ' ' ) }:** ${
|
||||||
|
results[ key ]
|
||||||
|
}\n`;
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
@ -26,7 +34,8 @@ module.exports = async ( { github, context } ) => {
|
||||||
|
|
||||||
output = buildOutput( results );
|
output = buildOutput( results );
|
||||||
} else {
|
} else {
|
||||||
output = `## Test Results Not Found!`;
|
output = `## Test Results Not Found! \n\n`;
|
||||||
|
output += 'The path to the `test-results.json` file may need to be updated.';
|
||||||
}
|
}
|
||||||
|
|
||||||
await github.rest.issues.createComment( {
|
await github.rest.issues.createComment( {
|
||||||
|
|
Loading…
Reference in New Issue