Skip to content

Commit

Permalink
Make 'source-root' init input relative to github.workspace
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mario-campos authored and aofaof0907 committed Jul 29, 2021
1 parent b68e0b2 commit 0197c38
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
5 changes: 2 additions & 3 deletions init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as path from "path";

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

import {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0197c38

Please sign in to comment.