From 9b540464b66c59d9b47166fd5894557393b22c9b Mon Sep 17 00:00:00 2001 From: ginglis13 Date: Mon, 9 Oct 2023 21:31:30 -0700 Subject: [PATCH] ci: check for changes to README and man page 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 --- .github/workflows/sync-readme-manpage.yml | 34 +++++++++++++++++++++++ .github/workflows/test.yml | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/sync-readme-manpage.yml diff --git a/.github/workflows/sync-readme-manpage.yml b/.github/workflows/sync-readme-manpage.yml new file mode 100644 index 0000000..4e18194 --- /dev/null +++ b/.github/workflows/sync-readme-manpage.yml @@ -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 "README and man page not in sync. Run `make man` to resolve." + exit 1 + fi + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e829b8..785abb7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,5 +11,5 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: make test