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

Fix loss of run-summary.md in GHA Job Summary #652

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/action/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ async function run(): Promise<void> {
'--disable-sandbox',
inputs.steward.extraArgs?.value.split(' ') ?? [],
], inputs.steward.extraJars)
} finally {
await workspace.saveWorkspaceCache()
await workspace.cancelTokenRefresh()
}

if (files.existsSync(workspace.runSummary_md)) {
logger.info(`✓ Run Summary file: ${workspace.runSummary_md}`)
if (files.existsSync(workspace.runSummary_md)) {
logger.info(`✓ Run Summary file: ${workspace.runSummary_md}`)

const summaryMarkdown = files.readFileSync(workspace.runSummary_md, 'utf8')
await core.summary.addRaw(summaryMarkdown).write()
const summaryMarkdown = files.readFileSync(workspace.runSummary_md, 'utf8')
await core.summary.addRaw(summaryMarkdown).write()
}
} finally {
await workspace.purgeTempFilesAndSaveCache()
await workspace.cancelTokenRefresh()
}
} catch (error: unknown) {
core.setFailed(` ✕ ${(error as Error).message}`)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ test('`Workspace.restoreWorkspaceCache()` → generates different hash for diffe
test('`Workspace.saveWorkspaceCache()` → saves cache', async t => {
const {workspace, calls} = fixture('- owner/repo')

await workspace.saveWorkspaceCache()
await workspace.purgeTempFilesAndSaveCache()

const now = Date.now()

Expand Down
2 changes: 1 addition & 1 deletion src/modules/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class Workspace {
*
* @param {string} workspace - the Scala Steward workspace directory
*/
async saveWorkspaceCache(): Promise<void> {
async purgeTempFilesAndSaveCache(): Promise<void> {
try {
this.logger.startGroup('Saving workspace to cache...')

Expand Down