mirror of
https://github.com/appleboy/ssh-action.git
synced 2026-08-31 16:49:32 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c4f70287fc | |||
| 6f15e4fabc | |||
| 7e02feefeb | |||
| ca58dd0ce3 | |||
| b838bc2f27 | |||
| 068c0c7a4e | |||
| 1530429296 | |||
| 81fc8ccc33 | |||
| 90162d1e43 | |||
| 8743aa11bf |
@@ -0,0 +1,36 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this action
|
||||
title: ""
|
||||
labels: enhancement
|
||||
assignees: appleboy
|
||||
---
|
||||
|
||||
## Is your feature request related to a problem?
|
||||
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
## Describe the solution you'd like
|
||||
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
## Example Yaml Config
|
||||
|
||||
If applicable, show how you would expect to use the new feature:
|
||||
|
||||
```yaml
|
||||
- name: executing remote ssh commands
|
||||
uses: appleboy/ssh-action@v1
|
||||
with:
|
||||
host: ${{ secrets.HOST }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
key: ${{ secrets.KEY }}
|
||||
script: whoami
|
||||
```
|
||||
|
||||
## Additional context
|
||||
|
||||
Add any other context about the feature request here. Note that SSH connection
|
||||
behavior (ciphers, timeouts, proxy, etc.) is implemented in
|
||||
[drone-ssh](https://github.com/appleboy/drone-ssh) - feature requests for
|
||||
connection behavior may belong there.
|
||||
@@ -0,0 +1,14 @@
|
||||
## Description
|
||||
|
||||
Please describe what this PR changes and why.
|
||||
|
||||
## Related Issues
|
||||
|
||||
Fixes #
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] Tests pass (`.github/workflows/main.yml` scenarios cover this change)
|
||||
- [ ] `action.yml` input descriptions updated (if adding/changing parameters)
|
||||
- [ ] README.md parameter tables updated (if adding/changing parameters)
|
||||
- [ ] Chinese translations updated (README.zh-cn.md, README.zh-tw.md)
|
||||
@@ -0,0 +1,10 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
labels:
|
||||
- "dependencies"
|
||||
commit-message:
|
||||
prefix: "chore(ci)"
|
||||
@@ -13,17 +13,17 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
go-version: "^1"
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
uses: goreleaser/goreleaser-action@v7
|
||||
with:
|
||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||
distribution: goreleaser
|
||||
|
||||
+26
-12
@@ -7,7 +7,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: create new ssh server
|
||||
run: |
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: add public key to env
|
||||
run: |
|
||||
@@ -142,7 +142,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: add public key to env
|
||||
run: |
|
||||
@@ -223,7 +223,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: add public key to env
|
||||
run: |
|
||||
@@ -297,7 +297,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: add public key to env
|
||||
run: |
|
||||
@@ -351,7 +351,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: add public key to env
|
||||
run: |
|
||||
@@ -496,10 +496,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set up WARP
|
||||
uses: fscarmen/warp-on-actions@v1.1
|
||||
uses: fscarmen/warp-on-actions@v1.4
|
||||
with:
|
||||
stack: dual
|
||||
|
||||
@@ -525,7 +525,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set Environment Variables
|
||||
run: |
|
||||
@@ -569,7 +569,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: create new ssh server
|
||||
run: |
|
||||
@@ -710,7 +710,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: create new ssh server
|
||||
run: |
|
||||
@@ -793,11 +793,25 @@ jobs:
|
||||
echo "Output contains 'True'"
|
||||
fi
|
||||
|
||||
windows-binary-download:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: test binary download and checksum verification
|
||||
shell: bash
|
||||
run: |
|
||||
export GITHUB_ACTION_PATH="$PWD"
|
||||
export INPUT_CURL_INSECURE=false
|
||||
export INPUT_CAPTURE_STDOUT=false
|
||||
./entrypoint.sh --help
|
||||
|
||||
testing-script-error:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: create new ssh server
|
||||
run: |
|
||||
|
||||
@@ -7,7 +7,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: create new ssh server
|
||||
run: |
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: add public key to env
|
||||
run: |
|
||||
@@ -127,7 +127,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: add public key to env
|
||||
run: |
|
||||
@@ -208,7 +208,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: add public key to env
|
||||
run: |
|
||||
@@ -282,7 +282,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: add public key to env
|
||||
run: |
|
||||
@@ -336,7 +336,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: add public key to env
|
||||
run: |
|
||||
|
||||
@@ -22,10 +22,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Run Trivy vulnerability scanner in repo mode
|
||||
uses: aquasecurity/trivy-action@0.33.1
|
||||
uses: aquasecurity/trivy-action@v0.36.0
|
||||
with:
|
||||
scan-type: 'fs'
|
||||
scan-ref: '.'
|
||||
@@ -33,19 +33,10 @@ jobs:
|
||||
format: 'sarif'
|
||||
output: 'trivy-results.sarif'
|
||||
severity: 'CRITICAL,HIGH,MEDIUM'
|
||||
exit-code: '1'
|
||||
|
||||
- name: Upload Trivy results to GitHub Security tab
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
uses: github/codeql-action/upload-sarif@v4
|
||||
if: always()
|
||||
with:
|
||||
sarif_file: 'trivy-results.sarif'
|
||||
|
||||
- name: Run Trivy vulnerability scanner (table format)
|
||||
uses: aquasecurity/trivy-action@0.33.1
|
||||
with:
|
||||
scan-type: 'fs'
|
||||
scan-ref: '.'
|
||||
scanners: 'vuln,secret,misconfig'
|
||||
format: 'table'
|
||||
severity: 'CRITICAL,HIGH,MEDIUM'
|
||||
exit-code: '1'
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# drone-ssh binaries downloaded by entrypoint.sh during local testing
|
||||
drone-ssh-*
|
||||
checksums.txt
|
||||
@@ -162,7 +162,7 @@ Or use ED25519 keys instead (preferred).
|
||||
|
||||
The action pins to specific drone-ssh versions via:
|
||||
|
||||
- Default: `DRONE_SSH_VERSION="1.8.2"` in `entrypoint.sh`
|
||||
- Default: `DRONE_SSH_VERSION="1.8.4"` in `entrypoint.sh`
|
||||
- Override: Users can specify `version` input parameter
|
||||
|
||||
Update the default version when new drone-ssh releases are available.
|
||||
|
||||
+38
-1
@@ -6,7 +6,7 @@ export GITHUB="true"
|
||||
|
||||
GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}"
|
||||
DRONE_SSH_RELEASE_URL="${DRONE_SSH_RELEASE_URL:-https://github.com/appleboy/drone-ssh/releases/download}"
|
||||
DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.8.2}"
|
||||
DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.8.4}"
|
||||
|
||||
# Error codes
|
||||
readonly ERR_UNKNOWN_PLATFORM=2
|
||||
@@ -26,6 +26,8 @@ function detect_client_info() {
|
||||
|
||||
case "${CLIENT_PLATFORM}" in
|
||||
darwin | linux | windows) ;;
|
||||
# Git Bash / MSYS2 / Cygwin on Windows runners report e.g. MINGW64_NT-10.0
|
||||
mingw* | msys* | cygwin*) CLIENT_PLATFORM="windows" ;;
|
||||
*) log_error "Unknown or unsupported platform: ${CLIENT_PLATFORM}. Supported platforms are Linux, Darwin, and Windows." "${ERR_UNKNOWN_PLATFORM}" ;;
|
||||
esac
|
||||
|
||||
@@ -39,6 +41,10 @@ function detect_client_info() {
|
||||
detect_client_info
|
||||
DOWNLOAD_URL_PREFIX="${DRONE_SSH_RELEASE_URL}/v${DRONE_SSH_VERSION}"
|
||||
CLIENT_BINARY="drone-ssh-${DRONE_SSH_VERSION}-${CLIENT_PLATFORM}-${CLIENT_ARCH}"
|
||||
# Windows release assets are published with an .exe suffix
|
||||
if [[ "${CLIENT_PLATFORM}" == "windows" ]]; then
|
||||
CLIENT_BINARY="${CLIENT_BINARY}.exe"
|
||||
fi
|
||||
TARGET="${GITHUB_ACTION_PATH}/${CLIENT_BINARY}"
|
||||
|
||||
# Check if binary already exists and is executable (caching)
|
||||
@@ -62,6 +68,37 @@ else
|
||||
log_error "Downloaded file is missing or empty: ${TARGET}" "${ERR_INVALID_BINARY}"
|
||||
fi
|
||||
|
||||
# Verify checksum; container jobs may lack shasum (Perl) or sha256sum, so
|
||||
# detect an available tool and skip verification with a warning if none exists
|
||||
SHA256_CMD=""
|
||||
if command -v shasum >/dev/null 2>&1; then
|
||||
SHA256_CMD="shasum -a 256"
|
||||
elif command -v sha256sum >/dev/null 2>&1; then
|
||||
SHA256_CMD="sha256sum"
|
||||
else
|
||||
echo "Warning: neither shasum nor sha256sum is available, skipping checksum verification" >&2
|
||||
fi
|
||||
|
||||
if [[ -n "${SHA256_CMD}" ]]; then
|
||||
CHECKSUMS_FILE="${GITHUB_ACTION_PATH}/checksums.txt"
|
||||
if ! curl -fsSL --retry 5 --keepalive-time 2 --location ${INSECURE_OPTION} \
|
||||
"${DOWNLOAD_URL_PREFIX}/checksums.txt" -o "${CHECKSUMS_FILE}"; then
|
||||
log_error "Failed to download checksums.txt from ${DOWNLOAD_URL_PREFIX}." "${ERR_DOWNLOAD_FAILED}"
|
||||
fi
|
||||
|
||||
EXPECTED_CHECKSUM=$(awk -v bin="${CLIENT_BINARY}" '$2 == bin {print $1}' "${CHECKSUMS_FILE}")
|
||||
if [[ -z "${EXPECTED_CHECKSUM}" ]]; then
|
||||
log_error "No checksum entry found for ${CLIENT_BINARY} in checksums.txt." "${ERR_INVALID_BINARY}"
|
||||
fi
|
||||
|
||||
ACTUAL_CHECKSUM=$(${SHA256_CMD} "${TARGET}" | awk '{print $1}')
|
||||
if [[ "${ACTUAL_CHECKSUM}" != "${EXPECTED_CHECKSUM}" ]]; then
|
||||
log_error "Checksum verification failed for ${CLIENT_BINARY}: expected ${EXPECTED_CHECKSUM}, got ${ACTUAL_CHECKSUM}." "${ERR_INVALID_BINARY}"
|
||||
fi
|
||||
echo "Checksum verification passed for ${CLIENT_BINARY}"
|
||||
rm -f "${CHECKSUMS_FILE}"
|
||||
fi
|
||||
|
||||
chmod +x "${TARGET}"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user