File tree 2 files changed +21
-8
lines changed 2 files changed +21
-8
lines changed Original file line number Diff line number Diff line change 53
53
uses : actions/upload-artifact@v3
54
54
with :
55
55
name : test-results-md
56
- path : ./tests/Tests.md
56
+ path : ./tests/Tests.txt
57
+
58
+ - name : Read Tests.txt for Slack message
59
+ id : read_tests
60
+ run : |
61
+ TESTS_CONTENT=$(cat ./tests/Tests.txt)
62
+ echo "TESTS_CONTENT<<EOF" >> $GITHUB_ENV
63
+ echo "$TESTS_CONTENT" >> $GITHUB_ENV
64
+ echo "EOF" >> $GITHUB_ENV
65
+
66
+ - name : Notify Slack with test results
67
+ uses : rtCamp/action-slack-notify@v2
68
+ env :
69
+ SLACK_COLOR : " #36a64f"
70
+ SLACK_MESSAGE : |
71
+ *Test Results:*
72
+ ${{ env.TESTS_CONTENT }}
73
+ SLACK_TITLE : Test Results Update
74
+ SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
Original file line number Diff line number Diff line change @@ -8,19 +8,14 @@ const __dirname = path.dirname(__filename);
8
8
9
9
// Define paths for the results and markdown files
10
10
const resultsPath = path . join ( __dirname , 'results.json' ) ;
11
- const markdownPath = path . join ( __dirname , 'Tests.md ' ) ;
11
+ const markdownPath = path . join ( __dirname , 'Tests.txt ' ) ;
12
12
13
13
// Read the Jest results
14
14
fs . readFile ( resultsPath , 'utf8' )
15
15
. then ( ( data ) => {
16
16
const results = JSON . parse ( data ) ;
17
17
18
- // Start constructing the Markdown table
19
- let markdownContent = `# Test Results\n\n` ;
20
- markdownContent += `| Test Name | Status |\n` ;
21
- markdownContent += `|-----------|--------|\n` ;
22
-
23
- // Iterate through each test result and populate the Markdown table
18
+ // Iterate through each test result and populate the table
24
19
results . testResults . forEach ( ( test ) => {
25
20
const testName = test . assertionResults [ 0 ] . fullName ;
26
21
const status = test . status === 'passed' ? '✅ Passed' : '❌ Failed' ;
You can’t perform that action at this time.
0 commit comments