Improve GitHub Actions hygiene

context: unknown commit, https://github.com/google/go-github/pull/1821
PiperOrigin-RevId: 362600035
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f25fcf4..039e662 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,7 +14,13 @@
 
 name: CI
 
-on: [ push, pull_request ]
+on:
+  push:
+    branches:
+    - master
+  pull_request:
+    branches:
+    - master
 
 jobs:
   test:
@@ -40,6 +46,10 @@
     runs-on: ${{ matrix.os }}
     continue-on-error: ${{ matrix.experimental }}
     steps:
+      - name: Cancel previous
+        uses: styfle/cancel-workflow-action@0.8.0
+        with:
+          access_token: ${{ github.token }}
       - name: 'Check out repository'
         uses: actions/checkout@v2
       - name: 'Cache local Maven repository'