Skip to content

Commit

Permalink
Actions: Enforce that the rendered copy of the man page is in sync
Browse files Browse the repository at this point in the history
  • Loading branch information
hartwork committed Jan 15, 2021
1 parent 4533a8a commit a488682
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/enforce-man-page-in-sync.yml
@@ -0,0 +1,56 @@
# This file is part of git-big-picture
#
# Copyright (C) 2020 Sebastian Pipping <sebastian@pipping.org>
#
# git-big-picture is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# git-big-picture is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with git-big-picture. If not, see <http://www.gnu.org/licenses/>.

name: Enforce man page in sync

on:
- pull_request
- push

jobs:
run_pre_commit:
name: Check if the man page is in sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.9
uses: actions/setup-python@v2.2.1
with:
python-version: 3.9

- name: Install build dependencies
run: |
sudo apt-get install --no-install-recommends -y help2man
- name: Install git-big-picture entry point script
run: |-
pip install \
--disable-pip-version-check \
--user \
--no-warn-script-location \
.
echo "PATH=${HOME}/.local/bin:${PATH}" >> "${GITHUB_ENV}"
- name: Check if the man page is in sync with --help output
run: |-
./generate-man-page.sh > git-big-picture.1
git diff --exit-code git-big-picture.1
- name: Check if the readme is in sync with --help output
run: |-
diff -U0 <(./extract-usage-from-readme.sh) <(git-big-picture --help)
22 changes: 22 additions & 0 deletions extract-usage-from-readme.sh
@@ -0,0 +1,22 @@
#! /usr/bin/env bash
# This file is part of git-big-picture
#
# Copyright (C) 2020 Sebastian Pipping <sebastian@pipping.org>
#
# git-big-picture is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# git-big-picture is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with git-big-picture. If not, see <http://www.gnu.org/licenses/>.

set -e
set -o pipefail

fgrep -A55 usage: README.rst | sed 's,^ ,,'

0 comments on commit a488682

Please sign in to comment.