Commit 935f85131fa106730bbf66d49808b5aca375f729

Edward Thomson 2021-02-15T16:03:23

CI: add workflow_dispatch event to the main build Invert the workflow conditionals so that a workflow_dispatch event acts like an on: push build.

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3d2102c..7179a61 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -7,6 +7,7 @@ on:
     branches: [ main, maint/* ]
   pull_request:
     branches: [ main, maint/* ]
+  workflow_dispatch:
 
 env:
   docker-registry: docker.pkg.github.com
@@ -48,7 +49,7 @@ jobs:
       uses: actions/checkout@v2
       with:
         fetch-depth: 0
-      if: github.event_name == 'push'
+      if: github.event_name != 'pull_request'
     - name: Setup QEMU
       run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
       if: matrix.container.qemu == true
@@ -59,7 +60,7 @@ jobs:
         DOCKER_REGISTRY: ${{ env.docker-registry }}
         GITHUB_TOKEN: ${{ secrets.github_token }}
       working-directory: ${{ env.docker-config-path }}
-      if: github.event_name == 'push'
+      if: github.event_name != 'pull_request'
     - name: Build and publish image
       run: |
         if [ "${{ matrix.container.base }}" != "" ]; then
@@ -68,7 +69,7 @@ jobs:
         docker build -t ${{ env.docker-registry-container-sha }} ${BASE_ARG} -f ${{ env.dockerfile }} .
         docker push ${{ env.docker-registry-container-sha }}
       working-directory: ${{ env.docker-config-path }}
-      if: github.event_name == 'push' && env.docker-container-exists != 'true'
+      if: github.event_name != 'pull_request' && env.docker-container-exists != 'true'
 
   # Run our CI/CD builds.  We build a matrix with the various build targets
   # and their details.  Then we build either in a docker container (Linux)
@@ -292,4 +293,4 @@ jobs:
         path: api-documentation.zip
     - name: Push documentation branch
       run: git push origin gh-pages
-      if: github.event_name == 'push' && github.repository == 'libgit2/libgit2'
+      if: github.event_name != 'pull_request' && github.repository == 'libgit2/libgit2'