-
-
Notifications
You must be signed in to change notification settings - Fork 297
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
feat: add custom working-directory support #157
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
// @ts-check | ||
import os from "os" | ||
import fs from "fs" | ||
import path from "path" | ||
import * as core from "@actions/core" | ||
import * as github from "@actions/github" | ||
import * as tc from "@actions/tool-cache" | ||
import { Octokit } from "@octokit/rest" | ||
import fs from "fs" | ||
import os from "os" | ||
import path from "path" | ||
|
||
import { execShellCommand, getValidatedInput, getLinuxDistro, useSudoPrefix } from "./helpers" | ||
import { execShellCommand, getLinuxDistro, getValidatedInput, useSudoPrefix } from "./helpers" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please refrain from mixing in such unrelated changes, it makes reviewing the changes unnecessarily harder. |
||
|
||
const TMATE_LINUX_VERSION = "2.4.0" | ||
|
||
|
@@ -26,6 +26,18 @@ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms)); | |
|
||
export async function run() { | ||
try { | ||
// custom working directory | ||
const workingDirectoryInput = core.getInput('working-directory'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This new |
||
if (workingDirectoryInput) { | ||
core.info(`Starting with custom working directory: ${workingDirectoryInput}`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This new |
||
} | ||
const workingDirectory = !workingDirectoryInput ? undefined : workingDirectoryInput; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about naming the variable |
||
|
||
// move to custom working directory if set | ||
if (workingDirectory) { | ||
process.chdir(workingDirectory); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something seems to be wrong with this call because it breaks the tests. The problem may be caused by A better idea may be to teach the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@chenrui333 This should be much easier now: I already introduced that |
||
} | ||
|
||
let tmateExecutable = "tmate" | ||
if (core.getInput("install-dependencies") !== "false") { | ||
core.debug("Installing dependencies") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refrain from mixing in such unrelated changes, it makes reviewing the changes unnecessarily harder.