Skip to content

⚙️ config(ci): Factor out custom github/event action. #26

⚙️ config(ci): Factor out custom github/event action.

⚙️ config(ci): Factor out custom github/event action. #26

Workflow file for this run

name: ci:precommit
on:
push:
branches:
- main
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: Continuous integration (test precommit)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
# TODO Fetch sparingly with something similar to
# https://github.com/rmacklin/fetch-through-merge-base/blob/main/action.yml
# Maybe could use commit count (does not exist on merge_group
# somehow)
# Maybe setting .git/shallow to base first would work in all cases?
# See https://stackoverflow.com/a/76573878
fetch-depth: 0
- name: Compute BASE_SHA, HEAD_SHA, and MERGE_BASE 📜

Check failure on line 32 in .github/workflows/ci:precommit.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci:precommit.yml

Invalid workflow file

You have an error in your yaml syntax on line 32
id: event
uses: .github/actions/github/event
- name: Stage MERGE_BASE...HEAD_SHA ⏮️
env:
HEAD_SHA: ${{ env.HEAD_SHA }}
MERGE_BASE: ${{ steps.event.outputs.merge-base }}
run: |
git reset --hard "${HEAD_SHA}"
git reset --soft "${MERGE_BASE}"
# TODO Do something destructive to check that it is not picked up.
- name: Install 💾
uses: ./.github/actions/install
- name: Run precommit 🔬
run: |
npm run precommit