Use github event in more github actions
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 22 Oct 2022 11:03:36 +0000 (13:03 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 22 Oct 2022 11:03:36 +0000 (13:03 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.github/workflows/ci.yml
.github/workflows/codeql-analysis.yml
.github/workflows/generate-typedoc.yml

index 3ee63b1992f20eefea43a6cdd9d0fa42d2e2141b..cdeb918394383e022e989c32f323468e00f6c6e0 100644 (file)
@@ -3,7 +3,7 @@ name: CI
 on:
   push:
     branches:
-      - master
+      - ${{ github.event.repository.default_branch }}
   pull_request:
     types: [opened, synchronize, reopened]
   workflow_dispatch:
index 3e61d69eb879f74d018cc4bd063225dac204880e..719e5743462e9e447bac5e9410443ccb7f2cc031 100644 (file)
@@ -13,10 +13,12 @@ name: 'CodeQL'
 
 on:
   push:
-    branches: [master]
+    branches:
+      - ${{ github.event.repository.default_branch }}
   pull_request:
     # The branches below must be a subset of the branches above
-    branches: [master]
+    branches:
+      - ${{ github.event.repository.default_branch }}
   schedule:
     - cron: '44 9 * * 3'
 
index 93d5c23b210e5b67988445b8ae76f070c948dc17..f69969a1cb101c4a092f5f21f8103e4c99332af9 100644 (file)
@@ -25,14 +25,14 @@ jobs:
           npm run typedoc
 
       - name: Commit files
-        if: "github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/master'"
+        if: "github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/${{ github.event.repository.default_branch }}'"
         run: |
           git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
           git config --local user.name "github-actions[bot]"
           git commit -m "Generate TypeDoc" -a
 
       - name: Push changes
-        if: "github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/master'"
+        if: "github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/${{ github.event.repository.default_branch }}'"
         uses: ad-m/github-push-action@master
         with:
           github_token: ${{ secrets.GITHUB_TOKEN }}