Skip to content

Commit

Permalink
🛠 Fix the parent directory for the report in custom directories
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Dec 21, 2021
1 parent c67baf6 commit 06d1461
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
24 changes: 14 additions & 10 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qodana-action",
"version": "4.1.0",
"version": "4.1.1",
"description": "Qodana is a code quality monitoring tool that identifies bugs, duplications, and imperfections.",
"main": "lib/main.js",
"scripts": {
Expand Down
30 changes: 13 additions & 17 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as cache from '@actions/cache'
import * as core from '@actions/core'
import * as glob from '@actions/glob'
import {Inputs} from './context'
import path from 'path'

export const QODANA_CHECK_NAME = 'Qodana'
export const QODANA_HELP_STRING = `
Expand Down Expand Up @@ -50,12 +51,12 @@ export function validateContext(inputs: Inputs): Inputs {

/**
* Restores the cache from GitHub Actions cache to the given path.
* @param path The path to restore the cache to.
* @param cacheDir The path to restore the cache to.
*/
export async function restoreCaches(path: string): Promise<void> {
export async function restoreCaches(cacheDir: string): Promise<void> {
try {
await cache.restoreCache(
[path],
[cacheDir],
`${process.env['RUNNER_OS']}-qodana-${process.env['GITHUB_REF']}`,
[
`${process.env['RUNNER_OS']}-qodana-${process.env['GITHUB_REF']}-`,
Expand All @@ -69,12 +70,12 @@ export async function restoreCaches(path: string): Promise<void> {

/**
* Uploads the cache to GitHub Actions cache from the given path.
* @param path The path to upload the cache from.
* @param cacheDir The path to upload the cache from.
*/
export async function uploadCaches(path: string): Promise<void> {
export async function uploadCaches(cacheDir: string): Promise<void> {
try {
await cache.saveCache(
[path],
[cacheDir],
`${process.env['RUNNER_OS']}-qodana-${process.env['GITHUB_REF']}-${process.env['GITHUB_SHA']}`
)
} catch (error) {
Expand All @@ -84,22 +85,17 @@ export async function uploadCaches(path: string): Promise<void> {

/**
* Uploads the Qodana report files from temp directory to GitHub job artifact.
* @param path The path to upload report from (should be somewhere in tmp).
* @param resultsDir The path to upload report from (should be somewhere in tmp).
*/
export async function uploadReport(path: string): Promise<void> {
export async function uploadReport(resultsDir: string): Promise<void> {
try {
const globber = await glob.create(`${path}/*`)
const globber = await glob.create(`${resultsDir}/*`)
const files = await globber.glob()
await artifact
.create()
.uploadArtifact(
'Qodana report',
files,
`${process.env['RUNNER_TEMP']}/qodana/`,
{
continueOnError: true
}
)
.uploadArtifact('Qodana report', files, path.dirname(resultsDir), {
continueOnError: true
})
} catch (error) {
core.warning(`Failed to upload report – ${(error as Error).message}`)
}
Expand Down

0 comments on commit 06d1461

Please sign in to comment.