Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make 'source-root' init input relative to github.workspace
In the previous commit, the default value of the input is ${{ github.workspace }}
which means that most uses of this input would probably prefix their paths with
${{ github.workspace }}, especially since actions/checkout's 'path' input
must be under ${{ github.workspace }}. Therefore, it doesn't make much sense for
this to be an absolute file path.

Instead, it's more intuitive to make this relative to the repository.
Mario Campos committed Jun 29, 2021

Unverified

No user is associated with the committer email.
1 parent 42babdf commit 337ae83
Showing 4 changed files with 13 additions and 9 deletions.
5 changes: 2 additions & 3 deletions init/action.yml
@@ -39,9 +39,8 @@ inputs:
required: true
default: 'true'
source-root:
description: The root source-code directory.
required: true
default: ${{ github.workspace }}
description: Path to the root source-code directory, relative to ${{ github.workspace }}.
required: false
outputs:
codeql-path:
description: The path of the CodeQL binary used for analysis
4 changes: 3 additions & 1 deletion lib/init-action.js

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

2 changes: 1 addition & 1 deletion lib/init-action.js.map

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

11 changes: 7 additions & 4 deletions src/init-action.ts
@@ -1,3 +1,5 @@
import * as path from "path";

import * as core from "@actions/core";

import {
@@ -201,11 +203,12 @@ async function run() {
const codeqlRam = process.env["CODEQL_RAM"] || "6500";
core.exportVariable("CODEQL_RAM", codeqlRam);

const tracerConfig = await runInit(
codeql,
config,
getRequiredInput("source-root")
const sourceRoot = path.join(
getRequiredEnvParam("GITHUB_WORKSPACE"),
getOptionalInput("source-root") || ""
);

const tracerConfig = await runInit(codeql, config, sourceRoot);
if (tracerConfig !== undefined) {
for (const [key, value] of Object.entries(tracerConfig.env)) {
core.exportVariable(key, value);

0 comments on commit 337ae83

Please sign in to comment.