Skip to content

Commit

Permalink
ci: check for changes to README and man page
Browse files Browse the repository at this point in the history
Adds a check to CI on changes to either README.rst or git-secrets.1 that
will fail if changes are made to one but not the other.

Also update action/checkout to v4

Fixes: #243

Signed-off-by: ginglis13 <[email protected]>
  • Loading branch information
ginglis13 committed Oct 10, 2023
1 parent 5357e18 commit 681aec4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/sync-readme-manpage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: "Sync README and man page"

on:
push:
branches:
- 'master'
paths:
- 'README.rst'
- 'git-secrets.1'
pull_request:
branches:
- 'master'
paths:
- 'README.rst'
- 'git-secrets.1'

jobs:
sync-readme-man-page:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
README_CHANGED=$(git diff --exit-code README.rst &>/dev/null; echo $?)
MANPAGE_CHANGED=$(git diff --exit-code git-secrets.1 &>/dev/null; echo $?)

if [[ $README_CHANGE == $MANPAGE_CHANGED ]]; then
echo "README and man page in sync."
exit 0
else
echo "If changes are made to one of {README.rst, git-secrets.1}, changes need to be made to the other."
exit 1
fi

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: make test

0 comments on commit 681aec4

Please sign in to comment.