Skip to content

Commit c6f0481

Browse files
authored
Merge pull request #217 from jeremyd2019/master
add new input msys2-location
2 parents cfc7cae + 0c00209 commit c6f0481

File tree

5 files changed

+29
-7
lines changed

5 files changed

+29
-7
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,24 @@ jobs:
208208
install-dependencies: false
209209
```
210210

211+
## Use a different MSYS2 location
212+
213+
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:
214+
215+
```yaml
216+
name: CI
217+
on: [push]
218+
jobs:
219+
build:
220+
runs-on: windows-latest
221+
steps:
222+
- uses: msys2/setup-msys2@v2
223+
id: setup-msys2
224+
- uses: mxschmitt/action-tmate@v3
225+
with:
226+
msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }}
227+
```
228+
211229
## Continue a workflow
212230

213231
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).

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ inputs:
4545
description: 'The ed25519 fingerprint for your tmate server'
4646
required: false
4747
default: ''
48+
msys2-location:
49+
description: 'The root of the MSYS2 installation (on Windows runners)'
50+
required: false
51+
default: 'C:\msys64'
4852
github-token:
4953
description: >
5054
Personal access token (PAT) used to call into GitHub's REST API.
5155
We recommend using a service account with the least permissions necessary.
5256
Also when generating a new PAT, select the least scopes necessary.
5357
[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)
54-
default: ${{ github.token }}
58+
default: ${{ github.token }}

lib/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17329,7 +17329,7 @@ const execShellCommand = (cmd, options) => {
1732917329
HOMEBREW_GITHUB_API_TOKEN: core.getInput('github-token') || undefined
1733017330
}
1733117331
}) :
17332-
(0,external_child_process_.spawn)("C:\\msys64\\usr\\bin\\bash.exe", ["-lc", cmd], {
17332+
(0,external_child_process_.spawn)(`${core.getInput("msys2-location") || "C:\\msys64"}\\usr\\bin\\bash.exe`, ["-lc", cmd], {
1733317333
env: {
1733417334
...process.env,
1733517335
"MSYS2_PATH_TYPE": "inherit", /* Inherit previous path */
@@ -17638,12 +17638,12 @@ async function run() {
1763817638
}
1763917639

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

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

src/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const execShellCommand = (cmd, options) => {
2828
HOMEBREW_GITHUB_API_TOKEN: core.getInput('github-token') || undefined
2929
}
3030
}) :
31-
spawn("C:\\msys64\\usr\\bin\\bash.exe", ["-lc", cmd], {
31+
spawn(`${core.getInput("msys2-location") || "C:\\msys64"}\\usr\\bin\\bash.exe`, ["-lc", cmd], {
3232
env: {
3333
...process.env,
3434
"MSYS2_PATH_TYPE": "inherit", /* Inherit previous path */

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,11 @@ export async function run() {
252252
}
253253

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

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

0 commit comments

Comments
 (0)