I tried to make a GitHub Actions workflow to launch commands on my server when I’m doing a pull request from any development branch into the uat
branch.
My script seems to contains everything it needs, the SSH key is saved on the account and everything, but when I’m doing a pull request nothing triggers, even if the test and the uat
branches both have the workflows saved in the .github/workflows
directory.
Here is my workflow:
name: Test Branch on PR to UAT
on:
pull_request:
branches:
- uat
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Run script on server
env:
TEST_BRANCH: ${{ github.event.pull_request.head.ref }}
run: |
ssh -o StrictHostKeyChecking=no myhostname@myipaddress << 'EOF'
here I put my ssh commands
EOF
I saw on another post that the issue might be that I need to use pull_request_target
, but I’m not sure.