Trigger GitHub Action Workflow By Pull Request

Viewed 660

I'd like to trigger automatically a GitHub Action Workflow for each [assigned, opened, synchronize, reopened] Git Pull Request from side-branch into master.

In addition, Is there a way to checkout the code from the private repository of a PR via branch name?

Below you can find my GitHub Action workflow that I've tried but unfortunately when I open a PR from side-branch into master it didn't trigger at all.

on:
  workflow_dispatch:
  pull_request:
    types: [assigned, opened, synchronize, reopened]
    branches:
      - master
jobs:
  build-image:
    name: Build Docker Image
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        ref: ${{github.event.pull_request.head.sha}}

Is it possible, how can I do that?

0 Answers
Related