Skip to content

Commit

Permalink
SQUASH 1
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed May 22, 2024
1 parent 1c2796e commit 5065fde
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
32 changes: 29 additions & 3 deletions .github/actions/github/event/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ description: >
outputs:

base-sha:
description: >
The base commit SHA for this event.
value: ${{ steps.base.outputs.sha }}

head-sha:
description: >
The head commit SHA for this event.
value: ${{ steps.head.outputs.sha }}

merge-base:
description: >
The merge base for this event.
The merge base commit SHA for this event.
value: ${{ steps.merge-base.outputs.sha }}

runs:
Expand Down Expand Up @@ -42,12 +52,28 @@ runs:
HEAD_SHA="${{ github.event.merge_group.head_sha }}"
echo "HEAD_SHA=${HEAD_SHA}" >> "${GITHUB_ENV}"
- name: Compute MERGE_BASE 🌱
id: merge-base
- name: Output BASE_SHA 🏕️
id: base
env:
BASE_SHA: ${{ env.BASE_SHA }}
shell: bash
run: |
echo "sha=${BASE_SHA}" >> "${GITHUB_OUTPUT}"
- name: Output HEAD_SHA 🗻
id: head
env:
HEAD_SHA: ${{ env.HEAD_SHA }}
shell: bash
run: |
echo "sha=${HEAD_SHA}" >> "${GITHUB_OUTPUT}"
- name: Compute MERGE_BASE 🌱
id: merge-base
env:
BASE_SHA: ${{ steps.base.outputs.sha }}
HEAD_SHA: ${{ steps.head.outputs.sha }}
shell: bash
run: |
FIRST_NEW_COMMIT="$(git log "${BASE_SHA}..${HEAD_SHA}" --pretty=format:%H | tail -1)"
MERGE_BASE="$(git rev-parse "${FIRST_NEW_COMMIT}~")"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci:commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:
# See https://stackoverflow.com/a/76573878
fetch-depth: 0

- name: Compute BASE_SHA, HEAD_SHA, and MERGE_BASE 📜
- name: Compute MERGE_BASE and HEAD_SHA 📜
id: event
uses: ./.github/actions/github/event

- name: Stage MERGE_BASE...HEAD_SHA ⏮️
env:
HEAD_SHA: ${{ env.HEAD_SHA }}
HEAD_SHA: ${{ steps.event.outputs.head-sha }}
MERGE_BASE: ${{ steps.event.outputs.merge-base }}
run: |
git reset --hard "${HEAD_SHA}"
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Run commit hooks 🔬
env:
HEAD_SHA: ${{ env.HEAD_SHA }}
HEAD_SHA: ${{ steps.event.outputs.head-sha }}
MERGE_BASE: ${{ steps.event.outputs.merge-base }}
run: |
MERGE_BASE_SHORT="$(git rev-parse --short "${MERGE_BASE}")"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci:precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:
# See https://stackoverflow.com/a/76573878
fetch-depth: 0

- name: Compute BASE_SHA, HEAD_SHA, and MERGE_BASE 📜
- name: Compute MERGE_BASE and HEAD_SHA 📜
id: event
uses: ./.github/actions/github/event

- name: Stage MERGE_BASE...HEAD_SHA ⏮️
env:
HEAD_SHA: ${{ env.HEAD_SHA }}
HEAD_SHA: ${{ steps.event.outputs.head-sha }}
MERGE_BASE: ${{ steps.event.outputs.merge-base }}
run: |
git reset --hard "${HEAD_SHA}"
Expand Down

0 comments on commit 5065fde

Please sign in to comment.