Skip to content

Use codespell

Use codespell #148

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: "Git commits"
on: # yamllint disable-line rule:truthy
pull_request: null
workflow_call: null
# Add [skip ci] to commit message to skip CI.
permissions: {} # yamllint disable-line rule:braces
#permissions: "read-all"
#permissions:
# contents: "read" # Private repositories need read permission
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
commit_authors:
name: "Commit author"
runs-on: "ubuntu-22.04"
timeout-minutes: 2
steps:
-
name: "Checkout repository"
uses: "actions/[email protected]"
with:
fetch-depth: 0
-
name: "Query commit email addresses from GitHub API"
env:
GH_TOKEN: "${{ github.token }}"
run: |
Check_author() {
local AUTHOR_EMAIL="$1"
local TOTAL_COUNT
if [ "${AUTHOR_EMAIL#*@}" = users.noreply.github.com ]; then
echo "${AUTHOR_EMAIL}: 1"
return
fi
TOTAL_COUNT="$(
gh api search/users \
--method GET \
--raw-field q="\"${AUTHOR_EMAIL}\" in:eml type:user" \
--jq '."total_count"'
)"
echo "${AUTHOR_EMAIL}: ${TOTAL_COUNT}"
if [ "${TOTAL_COUNT}" != 1 ]; then
echo "::error::Unknown commit email address: ${AUTHOR_EMAIL}"
fi
test "${TOTAL_COUNT}" = 1
}
COMMIT_RANGE="${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
git show --no-patch --pretty="format:%ae" "${COMMIT_RANGE}" \
| sort --unique \
| while read -r AUTHOR; do Check_author "${AUTHOR}"; done