Skip to content

Commit

Permalink
Merge branch 'main' into example-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrybyk authored Feb 14, 2024
2 parents 0bbd8ae + 3537993 commit 686f2b7
Show file tree
Hide file tree
Showing 10 changed files with 305 additions and 213 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/report_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ jobs:
outFile=test-results/Allure_Trend.csv
echo Passed,Failed,Total > $outFile
echo ${{ steps.allure.outputs.test_result_passed }},${{ steps.allure.outputs.test_result_failed }},${{ steps.allure.outputs.test_result_total }} >> $outFile
- name: Local HTML Report
if: always()
uses: ./ # Uses an action in the root directory
Expand Down Expand Up @@ -127,6 +126,7 @@ jobs:
with:
repository: gh-pages-dir
branch: gh-pages
pull_args: --rebase -X ours

- name: Comment PR with Allure Report link
if: ${{ always() && github.event_name == 'pull_request' && (steps.allure.outputs.report_url || steps.html-1.outputs.report_url || steps.chart-2.outputs.report_url) }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ See examples:

- [CSV report, single file, Allure Trend](https://mgrybyk.github.io/html-trend-report-action/report-action/main/Allure%20Trend%20Report/)
- [CSV report, multiple files, Lighthouse Trend](https://mgrybyk.github.io/html-trend-report-action/report-action/main/Lighthouse%20Trend%20Report/)
- [HTML Report](https://mgrybyk.github.io/html-trend-report-action/report-action/main/Lighthouse%20Report/7784322733_1707135682151/)
- [HTML Report](https://mgrybyk.github.io/html-trend-report-action/report-action/main/Lighthouse%20Report/latest.html)
- [HTML Report history](https://mgrybyk.github.io/html-trend-report-action/report-action/main/Lighthouse%20Report/)
- [Browse different branches](https://mgrybyk.github.io/html-trend-report-action/)
- [Pull Request Comment Example](https://github.com/mgrybyk/html-trend-report-action/pull/3)
Expand Down
56 changes: 48 additions & 8 deletions dist/index.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { isFileExist } from './src/isFileExists.js'
import { shouldWriteRootHtml, writeFolderListing } from './src/writeFolderListing.js'
import { getBranchName } from './src/helpers.js'
import { cleanupOutdatedBranches, cleanupOutdatedReports } from './src/cleanup.js'
import { writeLatestReport } from './src/writeLatest.js'

const baseDir = 'report-action'

Expand Down Expand Up @@ -66,6 +67,7 @@ try {
if (!['html', 'csv'].includes(reportType)) {
throw new Error('Unsupported report type: ' + reportType)
}
const isHtmlReport = reportType === 'html'

// action
await io.mkdirP(reportBaseDir)
Expand All @@ -79,7 +81,7 @@ try {
}

// process report
if (reportType === 'html') {
if (isHtmlReport) {
await io.cp(sourceReportDir, reportDir, { recursive: true })
} else if (reportType === 'csv') {
await csvReport(sourceReportDir, reportBaseDir, reportId, {
Expand All @@ -97,10 +99,13 @@ try {
if (listDirsBranch) {
await writeFolderListing(ghPagesPath, path.join(baseDir, branchName))
await writeFolderListing(ghPagesPath, path.join(baseDir, branchName))
if (reportType === 'html') {
if (isHtmlReport) {
await writeFolderListing(ghPagesPath, path.join(baseDir, branchName, reportId))
}
}
if (isHtmlReport) {
await writeLatestReport(reportBaseDir)
}

// outputs
core.setOutput('report_url', reportUrl)
Expand Down
Loading

0 comments on commit 686f2b7

Please sign in to comment.