Skip to content

Commit c9ecc41

Browse files
committed
Initial commit
1 parent d642bf1 commit c9ecc41

File tree

6 files changed

+43
-41
lines changed

6 files changed

+43
-41
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# comment this out distribution branches
2-
node_modules/
2+
#node_modules/
33

44
# Editors
55
.vscode

action.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
name: 'Wait'
2-
description: 'Wait a designated number of milliseconds'
3-
inputs:
4-
milliseconds: # id of input
5-
description: 'number of milliseconds to wait'
6-
required: true
7-
default: '1000'
8-
outputs:
9-
time: # output will be available to future steps
10-
description: 'The message to output'
1+
name: 'Debugger'
2+
description: 'Interactive debugger for GitHub Action with tmate.io'
113
runs:
124
using: 'node12'
135
main: 'index.js'

index.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
const core = require('@actions/core');
2-
const wait = require('./wait');
32

4-
5-
// most @actions toolkit packages have async methods
63
async function run() {
7-
try {
8-
const ms = core.getInput('milliseconds');
9-
console.log(`Waiting ${ms} milliseconds ...`)
10-
11-
core.debug((new Date()).toTimeString())
12-
wait(parseInt(ms));
13-
core.debug((new Date()).toTimeString())
14-
15-
core.setOutput('time', new Date().toTimeString());
16-
}
4+
try {
5+
// This is just a thin wrapper around bash
6+
var child = require('child_process').execFile('./script.sh');
7+
child.stdout.on('data', function(data) {
8+
console.log(data.toString());
9+
});
10+
}
1711
catch (error) {
1812
core.setFailed(error.message);
1913
}

package-lock.json

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

script.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo Setting up tmate
6+
if [ -x "$(command -v brew)" ]; then
7+
brew install tmate
8+
fi
9+
10+
if [ -x "$(command -v apt-get)" ]; then
11+
sudo apt-get install -y tmate openssh-client
12+
fi
13+
14+
[ -e ~/.ssh/id_rsa ] || ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ""
15+
16+
17+
echo Running tmate
18+
tmate -S /tmp/tmate.sock new-session -d
19+
tmate -S /tmp/tmate.sock wait tmate-ready
20+
tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}'
21+
22+
while [ -S /tmp/tmate.sock ]; do
23+
echo -ne "."
24+
sleep 1
25+
done
26+
27+

wait.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)