Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

49 add reusable workflow to check that email used in history is gcca #186

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/workflow-check-author-email.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# GitHub Actions Workflow: Verify Committer Email for `.gc.ca` Domain

- **Purpose:** This GitHub Actions workflow ensures that commits pushed
to the repository or part of a pull request are signed with an email
address ending in `.gc.ca`. This helps verify that contributors use a
valid government email domain when committing changes.

- **Usage:** Add this workflow to your repository to enforce email validation
on all pushes and pull requests targeting the `main` branch.

- **Required Secrets:**
- `GITHUB_TOKEN`: Token for authentication with GitHub.

## Workflow Steps

1. **Checkout the Repository:**
The workflow uses the `actions/checkout@v3` action to clone the repository
into the runner's workspace.

2. **Validate Committer Email:**
The workflow leverages the `dguo/check-author-and-committer-action@v1`
action to check that the committer's email matches the specified
domain pattern (`@gc.ca`).

3. **Custom Error Messaging:**
If any commit does not meet the email criteria, a custom error message
is displayed, guiding contributors to configure their email
address correctly.
15 changes: 15 additions & 0 deletions .github/workflows/workflow-check-author-email.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Verify Committer Email

Check warning on line 1 in .github/workflows/workflow-check-author-email.yml

View workflow job for this annotation

GitHub Actions / yaml-lint-check

1:1 [document-start] missing document start "---"
on:
workflow_call:
push:

jobs:
check-commit-author:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dguo/check-author-and-committer-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
committer-email-regex: '@(?:[a-zA-Z0-9-]+\.)?gc\.ca$'
custom-error-message: "Commits must be signed with an email address ending in .gc.ca. Please configure your email address correctly."
Loading