Skip to content

build: package local RC with verified manifest #32

build: package local RC with verified manifest

build: package local RC with verified manifest #32

Workflow file for this run

name: email-guard
on:
push:
pull_request:
jobs:
email-guard:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate author and committer emails
env:
EXPECTED_EMAIL: heap@posteo.jp
EVENT_NAME: ${{ github.event_name }}
BEFORE_SHA: ${{ github.event.before }}
AFTER_SHA: ${{ github.sha }}
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
shell: bash
run: |
set -euo pipefail
zero=0000000000000000000000000000000000000000
if [[ "$EVENT_NAME" == "pull_request" ]]; then
range="${PR_BASE_SHA}..${PR_HEAD_SHA}"
elif [[ "${BEFORE_SHA:-$zero}" == "$zero" ]]; then
range="$AFTER_SHA"
else
range="${BEFORE_SHA}..${AFTER_SHA}"
fi
mapfile -t commits < <(git rev-list "$range")
if [[ ${#commits[@]} -eq 0 ]]; then
echo "No commits to validate"
exit 0
fi
failed=0
for commit in "${commits[@]}"; do
author_email=$(git show -s --format=%ae "$commit")
committer_email=$(git show -s --format=%ce "$commit")
echo "Checking $commit author=$author_email committer=$committer_email"
if [[ "$author_email" != "$EXPECTED_EMAIL" ]]; then
echo "Invalid author email on $commit: $author_email"
failed=1
fi
if [[ "$committer_email" != "$EXPECTED_EMAIL" ]]; then
echo "Invalid committer email on $commit: $committer_email"
failed=1
fi
done
exit "$failed"