Fix Gitea actions syntax on push events

The Github documentation is difficult to parse, but there is an
asymmetry in the API:
- for a PR event, the event object contains a `pull_request` object
  containing `base` and `head` objects
- for a push event, the `before` and `after` SHAs are immediate
  children of the event object

<https://docs.github.com/en/webhooks/webhook-events-and-payloads>

Fixes #7730.
This commit is contained in:
Itms 2025-05-15 11:15:32 +02:00
parent 83674e1d1b
commit 416ba3fc2b
No known key found for this signature in database
GPG key ID: C7E52BD14CE14E09
2 changed files with 5 additions and 4 deletions

View file

@ -4,8 +4,8 @@ on:
- push
- pull_request
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.push.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.push.after }}
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
jobs:
lfscheck:

View file

@ -2,10 +2,11 @@
# yamllint disable rule:line-length
name: lint
on:
- push
- pull_request
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
jobs:
cppcheck: