From 1466448394f6124f630cecbacf0d204b9e6b38ca Mon Sep 17 00:00:00 2001 From: megamiley Date: Tue, 4 Aug 2026 18:59:47 +0000 Subject: [PATCH] Add action.yml --- action.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 action.yml diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..2fc7b77 --- /dev/null +++ b/action.yml @@ -0,0 +1,56 @@ +name: 'Gitea SSH Command' +description: 'Executes a shell command/script on a remote server via SSH on a custom port.' + +inputs: + private_key: + description: 'Private SSH Key' + required: true + command: + description: 'Shell command or multi-line script to run on the remote server' + required: true + host: + description: 'Remote server hostname or IP' + required: true + username: + description: 'SSH username' + required: true + port: + description: 'SSH port' + required: false + default: '22' + +runs: + using: "composite" + steps: + - name: Run SSH Command + shell: bash # Required for composite actions + env: + SSH_KEY: ${{ inputs.private_key }} + COMMAND: ${{ inputs.command }} + HOST: ${{ inputs.host }} + USERNAME: ${{ inputs.username }} + PORT: ${{ inputs.port }} + run: | + set -euo pipefail + + # 1. Setup the SSH directory and private key + mkdir -p ~/.ssh + chmod 700 ~/.ssh + echo "$SSH_KEY" > ~/.ssh/ssh_command_key + chmod 600 ~/.ssh/ssh_command_key + + # 2. Configure SSH for the custom port/user and bypass host key prompt + cat >> ~/.ssh/config <