Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,24 @@ jobs:
install-dependencies: false
```

## Use a different MSYS2 location

If you want to integrate with the msys2/setup-msys2 action or otherwise don't have an MSYS2 installation at `C:\msys64`, you can specify a different location for MSYS2:

```yaml
name: CI
on: [push]
jobs:
build:
runs-on: windows-latest
steps:
- uses: msys2/setup-msys2@v2
id: setup-msys2
- uses: mxschmitt/action-tmate@v3
with:
msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }}
```

## Continue a workflow

If you want to continue a workflow and you are inside a tmate session, just create a empty file with the name `continue` either in the root directory or in the project directory by running `touch continue` or `sudo touch /continue` (on Linux).
Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ inputs:
description: 'The ed25519 fingerprint for your tmate server'
required: false
default: ''
msys2-location:
description: 'The root of the MSYS2 installation (on Windows runners)'
required: false
default: 'C:\msys64'
github-token:
description: >
Personal access token (PAT) used to call into GitHub's REST API.
We recommend using a service account with the least permissions necessary.
Also when generating a new PAT, select the least scopes necessary.
[Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
default: ${{ github.token }}
default: ${{ github.token }}
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17329,7 +17329,7 @@ const execShellCommand = (cmd, options) => {
HOMEBREW_GITHUB_API_TOKEN: core.getInput('github-token') || undefined
}
}) :
(0,external_child_process_.spawn)("C:\\msys64\\usr\\bin\\bash.exe", ["-lc", cmd], {
(0,external_child_process_.spawn)(`${core.getInput("msys2-location") || "C:\\msys64"}\\usr\\bin\\bash.exe`, ["-lc", cmd], {
env: {
...process.env,
"MSYS2_PATH_TYPE": "inherit", /* Inherit previous path */
Expand Down Expand Up @@ -17638,12 +17638,12 @@ async function run() {
}

function didTmateQuit() {
const tmateSocketPath = process.platform === "win32" ? "C:/msys64/tmp/tmate.sock" : "/tmp/tmate.sock"
const tmateSocketPath = process.platform === "win32" ? `${core.getInput("msys2-location") || "C:\\msys64"}/tmp/tmate.sock` : "/tmp/tmate.sock"
return !external_fs_default().existsSync(tmateSocketPath)
}

function continueFileExists() {
const continuePath = process.platform === "win32" ? "C:/msys64/continue" : "/continue"
const continuePath = process.platform === "win32" ? `${core.getInput("msys2-location") || "C:\\msys64"}/continue` : "/continue"
return external_fs_default().existsSync(continuePath) || external_fs_default().existsSync(external_path_default().join(process.env.GITHUB_WORKSPACE, "continue"))
}

Expand Down
2 changes: 1 addition & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const execShellCommand = (cmd, options) => {
HOMEBREW_GITHUB_API_TOKEN: core.getInput('github-token') || undefined
}
}) :
spawn("C:\\msys64\\usr\\bin\\bash.exe", ["-lc", cmd], {
spawn(`${core.getInput("msys2-location") || "C:\\msys64"}\\usr\\bin\\bash.exe`, ["-lc", cmd], {
env: {
...process.env,
"MSYS2_PATH_TYPE": "inherit", /* Inherit previous path */
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ export async function run() {
}

function didTmateQuit() {
const tmateSocketPath = process.platform === "win32" ? "C:/msys64/tmp/tmate.sock" : "/tmp/tmate.sock"
const tmateSocketPath = process.platform === "win32" ? `${core.getInput("msys2-location") || "C:\\msys64"}/tmp/tmate.sock` : "/tmp/tmate.sock"
return !fs.existsSync(tmateSocketPath)
}

function continueFileExists() {
const continuePath = process.platform === "win32" ? "C:/msys64/continue" : "/continue"
const continuePath = process.platform === "win32" ? `${core.getInput("msys2-location") || "C:\\msys64"}/continue` : "/continue"
return fs.existsSync(continuePath) || fs.existsSync(path.join(process.env.GITHUB_WORKSPACE, "continue"))
}