File tree Expand file tree Collapse file tree 4 files changed +56
-2
lines changed Expand file tree Collapse file tree 4 files changed +56
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : test
2
+ on :
3
+ workflow_dispatch :
4
+ pull_request :
5
+ push :
6
+ branches :
7
+ - ' main'
8
+
9
+ jobs :
10
+ test :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - uses : actions/checkout@v4
14
+
15
+ - name : Move local action to folder where it can be tested
16
+ shell : bash
17
+ run : |
18
+ mkdir -p .github/actions/test
19
+ cp action.yml .github/actions/test/action.yml
20
+
21
+ - uses : ./.github/actions/test
22
+ with :
23
+ service-key : ${{ secrets.SERVICE_KEY }}
24
+
25
+ - name : (optional) Twingate logs
26
+ run : journalctl -u twingate
27
+
28
+ - name : (optional) Twingate status
29
+ run : twingate status
30
+
31
+ - name : Access a secure resource
32
+ env :
33
+ TEST_URL : http://business.prod.beamreachinc.int/
34
+ run : |
35
+ echo Calling $TEST_URL 🚀
36
+ curl -v $TEST_URL
37
+
38
+ - run : echo "SUCCESS!!! 🤩 This job's status is ${{ job.status }}."
Original file line number Diff line number Diff line change
1
+ /.secrets
Original file line number Diff line number Diff line change @@ -18,3 +18,13 @@ There are two common use cases:
18
18
# Required
19
19
service-key : ${{ secrets.EXAMPLE_SERVICE_KEY_SECRET_NAME }}
20
20
` ` `
21
+
22
+
23
+ # Development
24
+
25
+ To run action locally to debug you can use ` act` (`brew install act`):
26
+ ```
27
+ act -j test -s SERVICE_KEY --container-options "--cap-add NET_ADMIN --device /dev/net/tun"
28
+ ```
29
+
30
+ It'll ask for `SERVICE_KEY` value interactively.
Original file line number Diff line number Diff line change @@ -13,31 +13,36 @@ runs:
13
13
- name : Install Twingate
14
14
shell : bash
15
15
run : |
16
+ sudo apt update
16
17
echo "deb [trusted=yes] https://packages.twingate.com/apt/ /" | sudo tee /etc/apt/sources.list.d/twingate.list
17
18
sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/twingate.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
18
19
sudo apt install -yq twingate
19
20
- name : Setup and start Twingate
20
21
shell : bash
21
22
run : |
22
- echo '${{ inputs.service-key }}' | sudo twingate setup --headless= -
23
+ echo '${{ inputs.service-key }}' | sudo twingate setup --headless -
23
24
MAX_RETRIES=5
24
25
WAIT_TIME=5
25
26
n=0
26
27
27
28
while [ $n -lt $MAX_RETRIES ]; do
28
29
echo "Starting Twingate service..."
30
+ set +xe
29
31
sudo twingate start
30
32
31
33
echo "Waiting $WAIT_TIME seconds for Twingate service to start..."
32
34
sleep $WAIT_TIME
33
35
34
- status=$(sudo twingate status)
36
+ status=$(twingate status)
37
+ echo "Twingate service status: '$status'"
35
38
36
39
if [ "$status" = "online" ]; then
37
40
echo "Twingate service is connected."
41
+ twingate resources
38
42
break
39
43
else
40
44
sudo twingate stop
45
+ journalctl -u twingate --no-pager
41
46
fi
42
47
43
48
# Increment the retry counter and wait time
You can’t perform that action at this time.
0 commit comments