1 | initial version |
To utilize Github Actions to execute 'git pull' on the server upon receiving a pull request submitted to the master branch, follow these steps:
Create a new Github Actions workflow by creating a .yml file in the .github/workflows directory. For example, create a file named "pull-request.yml".
Define the event that should trigger the workflow to run. In this case, the trigger should be a new pull request created on the master branch. Add the following code to the "on" section of the workflow file:
on:
pull_request:
branches:
- master
jobs:
deploy:
runs-on: [server]
steps:
- name: Pull latest changes
run: |
ssh user@server 'cd /path/to/repo/ && git pull'
Now, whenever a new pull request is created on the master branch, Github Actions will trigger the workflow defined in the "pull-request.yml" file. This workflow will run on a server (as defined in the "runs-on" section), and it will execute a 'git pull' command on the server to pull the latest changes from the master branch.