Skip to content

GitHub Action: Remote Fetch & Pull. Allows you to securely fetch and pull the latest changes from a remote Git repository via SSH

License

Notifications You must be signed in to change notification settings

YaCenturion/ssh-fetch-pull

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 GitHub Action: Remote Fetch & Pull

This GitHub Action allows you to securely fetch and pull the latest changes from a remote Git repository via SSH.
It also supports executing custom commands before and after the update process.

Features

  • Secure SSH connection using a private key
  • Git fetch & pull to update the repository
  • Custom pre/post commands for additional automation
  • Easy integration into any workflow

🛠 Simple example

To use this action in your workflow, add the following to your .github/workflows/deploy.yml:

on:
  push:
    branches: [ "deploy" ]
  pull_request:
    branches: [ "deploy" ]
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Update remote repo
        uses: yacenturion/ssh-fetch-pull@v1
        with:
          HOST: "8.10.17.10"
          USERNAME: "root"
          SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
          DEST_PATH: "/srv/myproject"
          RUN_BEFORE: "echo 'Starting deployment...'"
          RUN_AFTER: "systemctl restart nginx; ls -la"

⚙️ All Inputs

Name Description Required
HOST Target server hostname or IP address. ✅ Yes
USERNAME SSH username for authentication. ✅ Yes
SSH_KEY Private SSH key for secure connection (use GitHub Secrets). ✅ Yes
DEST_PATH Absolute path to the Git repository on the server. ✅ Yes
RUN_BEFORE Optional bash commands to execute before git pull. ❌ No
RUN_AFTER Optional bash commands to execute after git pull. ❌ No

About

GitHub Action: Remote Fetch & Pull. Allows you to securely fetch and pull the latest changes from a remote Git repository via SSH

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published