Skip to content

Commit e8e216c

Browse files
author
Jose Diaz-Gonzalez
committed
tests: add shfmt support
1 parent 99b5d22 commit e8e216c

File tree

6 files changed

+34
-19
lines changed

6 files changed

+34
-19
lines changed

.github/workflows/lint.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ jobs:
3838
uses: ludeeus/action-shellcheck@d586102c117f97e63d7e3b56629d269efc9a7c60
3939
# 1.0.0 => d586102c117f97e63d7e3b56629d269efc9a7c60
4040

41+
shfmt:
42+
name: shfmt
43+
runs-on: ubuntu-20.04
44+
steps:
45+
- name: Clone
46+
uses: actions/checkout@v2
47+
- name: Run shfmt
48+
uses: luizm/action-sh-checker@802b81f66b6c31ea423aa41ad4f49f4b7b869272
49+
# v0.1.8 => 802b81f66b6c31ea423aa41ad4f49f4b7b869272
50+
env:
51+
SHFMT_OPTS: -l -d -i 2
52+
with:
53+
sh_checker_checkbashisms_enable: true
54+
sh_checker_shellcheck_disable: true
55+
4156
yamllint:
4257
name: yamllint
4358
runs-on: ubuntu-20.04

bin/dokku-unlock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
setup-ssh
55

6-
log-info "Unlocking Dokku deployment";
6+
log-info "Unlocking Dokku deployment"
77

88
ssh_port=$(parse-ssh-port)
99
ssh_host=$(parse-ssh-host)

bin/entrypoint

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,36 @@ action="$1"
77
action_arg="$2"
88

99
if [ "$action" = "review-apps:create" ] || [ "$action" = 'review-apps:destroy' ]; then
10-
if [ -z "$action_arg" ]; then
11-
log-error "No review app name specified"
12-
exit 1
13-
fi
10+
if [ -z "$action_arg" ]; then
11+
log-error "No review app name specified"
12+
exit 1
13+
fi
1414
fi
1515

1616
app_name="$(parse-app-name)"
1717
review_app_name="${action_arg}"
1818
ssh_remote="ssh://dokku@$(parse-ssh-host):$(parse-ssh-port)"
1919

2020
if [ "$action" = "review-app:destroy" ]; then
21-
log-info "Destroying review app '${review_app_name}'"
22-
ssh "$ssh_remote" -- --force apps:destroy "$review_app_name"
23-
exit 0
21+
log-info "Destroying review app '${review_app_name}'"
22+
ssh "$ssh_remote" -- --force apps:destroy "$review_app_name"
23+
exit 0
2424
fi
2525

2626
if [ -n "$action" ] && [ "$action" != "review-apps:create" ]; then
27-
log-error "Invalid action specified"
28-
exit 1
27+
log-error "Invalid action specified"
28+
exit 1
2929
fi
3030

3131
if [ "$action" = "review-apps:create" ]; then
32-
log-info "Ensuring review app '${review_app_name}' exists"
33-
ssh "$ssh_remote" -- apps:clone --skip-deploy --ignore-existing "$app_name" "$review_app_name"
32+
log-info "Ensuring review app '${review_app_name}' exists"
33+
ssh "$ssh_remote" -- apps:clone --skip-deploy --ignore-existing "$app_name" "$review_app_name"
3434
fi
3535

36-
log-info "Pushing to Dokku Host";
36+
log-info "Pushing to Dokku Host"
3737

3838
if [ -n "$review_app_name" ] && [ "$app_name" != "$review_app_name" ]; then
39-
GIT_REMOTE_URL="${GIT_REMOTE_URL%"/$app_name"}/${review_app_name}"
39+
GIT_REMOTE_URL="${GIT_REMOTE_URL%"/$app_name"}/${review_app_name}"
4040
fi
4141

4242
git push "$GIT_PUSH_FLAGS" "$GIT_REMOTE_URL" "$GITHUB_SHA:refs/heads/$BRANCH" --force

bin/parse-app-name

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh -l
22
set -e
33

4-
echo "$GIT_REMOTE_URL" | sed -e 's/.*\///'
4+
echo "$GIT_REMOTE_URL" | sed -e 's/.*\///'

bin/parse-ssh-port

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ if [ -z "$ssh_port" ]; then
66
ssh_port=22
77
fi
88

9-
echo $ssh_port
9+
echo $ssh_port

bin/setup-ssh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ set -e
44
log-info "Setting up SSH Key"
55

66
mkdir -p /root/.ssh
7-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > /root/.ssh/id_rsa
7+
echo "$SSH_PRIVATE_KEY" | tr -d '\r' >/root/.ssh/id_rsa
88
chmod 600 /root/.ssh/id_rsa
99
chmod 700 /root/.ssh
1010

1111
if [ -n "$SSH_HOST_KEY" ]; then
1212
log-info "Adding SSH_HOST_KEY to known_hosts"
13-
echo "$SSH_HOST_KEY" >> "/root/.ssh/known_hosts"
13+
echo "$SSH_HOST_KEY" >>"/root/.ssh/known_hosts"
1414
chmod 600 "/root/.ssh/known_hosts"
1515
else
1616
ssh_port=$(parse-ssh-port)
1717
ssh_host=$(parse-ssh-host)
1818

1919
log-info "Generating SSH_HOST_KEY from ssh-keyscan against $ssh_host:$ssh_port"
20-
ssh-keyscan -H -p "$ssh_port" "$ssh_host" >> /root/.ssh/known_hosts
20+
ssh-keyscan -H -p "$ssh_port" "$ssh_host" >>/root/.ssh/known_hosts
2121
fi
2222

2323
log-info "Adding SSH Key to ssh-agent"

0 commit comments

Comments
 (0)