Skip to content

Commit b0c570e

Browse files
committed
autobuild: add working-directory input
1 parent 2d80fe8 commit b0c570e

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## [UNRELEASED]
44

5-
No user facing changes.
5+
- Add `working-directory` input to the `autobuild` action. [#1024](https://github.com/github/codeql-action/pull/1024)
66

77
## 2.1.8 - 08 Apr 2022
88

autobuild/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ inputs:
66
default: ${{ github.token }}
77
matrix:
88
default: ${{ toJson(matrix) }}
9+
working-directory:
10+
description: >-
11+
Run the autobuilder using this path (relative to $GITHUB_WORKSPACE) as
12+
working directory. If this input is not set, the autobuilder runs with
13+
$GITHUB_WORKSPACE as its working directory.
14+
required: false
915
runs:
1016
using: 'node16'
11-
main: '../lib/autobuild-action.js'
17+
main: '../lib/autobuild-action.js'

lib/autobuild-action.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/autobuild-action.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/autobuild-action.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as core from "@actions/core";
33
import {
44
createStatusReportBase,
55
getActionsStatus,
6+
getOptionalInput,
67
getTemporaryDirectory,
78
sendStatusReport,
89
StatusReportBase,
@@ -71,6 +72,13 @@ async function run() {
7172
}
7273
language = determineAutobuildLanguage(config, logger);
7374
if (language !== undefined) {
75+
const workingDirectory = getOptionalInput("working-directory");
76+
if (workingDirectory) {
77+
logger.info(
78+
`Changing autobuilder working directory to ${workingDirectory}`
79+
);
80+
process.chdir(workingDirectory);
81+
}
7482
await runAutobuild(language, config, logger);
7583
}
7684
} catch (error) {

0 commit comments

Comments
 (0)