-
Notifications
You must be signed in to change notification settings - Fork 89
64 lines (63 loc) · 2.15 KB
/
test-setup-ssh.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Test setup ssh
on:
pull_request:
paths:
- .github/workflows/test-setup-ssh.yml
- .github/actions/setup-ssh/action.yml
- .github/actions/setup-ssh/index.js
- setup-ssh/**
workflow_dispatch:
jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
cd setup-ssh
yarn install
- run: |
cd setup-ssh
yarn run all
test-linux: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-ssh
name: Check if can write keys
with:
github-secret: ${{ secrets.GITHUB_TOKEN }}
activate-with-label: false
instructions: "First install, username is %%username%%"
- uses: ./.github/actions/setup-ssh
name: Check if can overwrite keys
with:
github-secret: ${{ secrets.GITHUB_TOKEN }}
activate-with-label: false
- name: Check SSH key is there
if: (github.event_name == 'pull_request')
run: |
test -e ~/.ssh/authorized_keys
# Check that file contents match, strip trailing newline from curl call
diff \
<(curl -fsSL "https://github.com/${{ github.actor}}.keys" | sed -z '$ s/\n$//') \
~/.ssh/authorized_keys
- name: Check SSH key is not there
if: (github.event_name == 'push')
run: |
# Check that file does not exist for push
test -e ~/.ssh/authorized_keys || exit 0
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-ssh
name: Check if can write keys
with:
github-secret: ${{ secrets.GITHUB_TOKEN }}
activate-with-label: false
instructions: "SSH with rdesktop using ssh -L 3389:localhost:3389 %%username%%@%%hostname%%"
- uses: ./.github/actions/setup-ssh
name: Check if can overwrite keys
with:
github-secret: ${{ secrets.GITHUB_TOKEN }}
activate-with-label: false