-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
49 add reusable workflow to check that email used in history is gcca (#…
…186) * issue #49: check email author signature * issue #49: workflow doc * issue #49: added on push * issue #49: test * issue #49: test * issue #49: changed regex expression
- Loading branch information
1 parent
a90e8df
commit a006dca
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Verify Committer Email | ||
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." |