Skip to content

Commit 64ba371

Browse files
committed
conditionally run jobs on push
1 parent 353411a commit 64ba371

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ on:
99
pull_request:
1010
release:
1111
types: [published]
12-
check_suite:
13-
types: [rerequested]
1412

1513
concurrency:
1614
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -64,24 +62,32 @@ jobs:
6462
PULL: ${{ github.event.number }}
6563
GITHUB_TOKEN: ${{ github.token }}
6664
EXCLUDE_COMMIT: ${{ github.event.pull_request.head.sha }}
67-
- name: Set head sha
65+
- name: Set head sha (pull)
6866
if: github.event_name == 'pull_request'
6967
run: echo "HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
70-
- name: Set base sha
68+
- name: Set base sha (pull)
7169
if: github.event_name == 'pull_request'
7270
run: |
7371
git fetch --no-tags --no-recurse-submodules --depth=$((DEPTH + 1)) origin $HEAD_SHA
7472
echo "BASE_SHA=$(git rev-list $HEAD_SHA --skip=$DEPTH --max-count=1)" >> $GITHUB_ENV
7573
env:
7674
DEPTH: ${{ steps.get-last-commit-with-checks.outputs.commit_depth || github.event.pull_request.commits }}
75+
- name: Set head sha (push)
76+
if: github.event_name == 'push'
77+
run: echo "HEAD_SHA=${{ github.event.after }}" >> $GITHUB_ENV
78+
- name: Set base sha (push)
79+
if: github.event_name == 'push'
80+
run: git cat-file -e $SHA && echo "BASE_SHA=$SHA" >> $GITHUB_ENV || true
81+
env:
82+
SHA: ${{ github.event.before }}
7783
- name: Get changes
7884
id: get-changes
79-
if: github.event_name == 'pull_request'
85+
if: env.BASE_SHA && env.HEAD_SHA
8086
run: echo $(git diff $BASE_SHA...$HEAD_SHA --name-only) | echo "changed_files=[\"$(sed "s/ /\", \"/g")\"]" >> $GITHUB_OUTPUT
8187
- name: Set matrix
8288
id: set-matrix
83-
working-directory: tools
8489
run: python3 -u ci_set_matrix.py
90+
working-directory: tools
8591
env:
8692
CHANGED_FILES: ${{ steps.get-changes.outputs.changed_files }}
8793
LAST_FAILED_JOBS: ${{ steps.get-last-commit-with-checks.outputs.check_runs }}

.github/workflows/create-website-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: Update CircuitPython.org
66

77
on:
88
release:
9-
types: [published, rerequested]
9+
types: [published]
1010

1111
jobs:
1212
website:

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
name: pre-commit
66

77
on:
8-
pull_request:
98
push:
9+
pull_request:
1010

1111
concurrency:
1212
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

0 commit comments

Comments
 (0)