Skip to content

Commit

Permalink
Make authors tolerates getting no authors from git
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Maier <[email protected]>
  • Loading branch information
andy-maier committed Oct 9, 2024
1 parent 955f6cc commit ae421af
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 44 deletions.
58 changes: 16 additions & 42 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,73 +156,47 @@ jobs:
# This is needed to get the authors from git.
fetch-depth: 0

- name: Debug - Display git authors
run: |
git shortlog --summary --email
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Downgrade Git version
- name: Debug - Display git log count
run: |
echo "Info for git package:"
sudo apt show git
echo "Policy for git package:"
sudo apt policy git
echo "git version:"
git --version
which git
# echo "Adding git-core repository:"
# sudo add-apt-repository -y ppa:git-core/ppa
echo "Updating package list:"
sudo apt-get update
echo "Downgrading git package:"
sudo apt-get install -y git=1:2.34.1
echo "Info for git package:"
sudo apt show git
echo "git version:"
git --version
which git
git log --oneline | wc
- name: Debug - Display git authors
run: |
git shortlog --summary --email
- name: Debug - Display git log
run: |
git log -1 --decorate
- name: Debug - Display git status
run: |
git status
- name: Debug - Display git describe
run: |
git describe --dirty --tags --long --match "*[0-9]*"
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Development setup
run: |
make develop
- name: Display Python packages
run: |
pip list
#-------- Publishing of package
- name: Debug - Display git status
run: |
git status
- name: Debug - Display git describe
run: |
git describe --dirty --tags --long --match "*[0-9]*"
- name: Debug - Display package version
- name: Display Python packages
run: |
python -m setuptools_scm
pip list
#-------- Publishing of package
- name: Build the distribution
run: |
make build
- name: Display the distribution directory
run: |
ls -l dist
- name: Fail
run: |
false
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,12 @@ AUTHORS.md: _always
echo "" >>AUTHORS.md.tmp
echo "Sorted list of authors derived from git commit history:" >>AUTHORS.md.tmp
echo '```' >>AUTHORS.md.tmp
git shortlog --summary --email | cut -f 2 | sort >>AUTHORS.md.tmp
sh -c "git shortlog --summary --email | cut -f 2 | sort >log.tmp"
sh -c "ls -l log.tmp"
sh -c "cat log.tmp >>AUTHORS.md.tmp"
echo '```' >>AUTHORS.md.tmp
sh -c "if ! diff -q AUTHORS.md.tmp AUTHORS.md; then echo 'Updating AUTHORS.md:'; diff AUTHORS.md.tmp AUTHORS.md; mv AUTHORS.md.tmp AUTHORS.md; else echo 'AUTHORS.md is up to date'; rm AUTHORS.md.tmp; fi"
sh -c "if ! grep -q '[^[:space:]]' log.tmp; then echo 'Warning - git shortlog does not display any authors - leaving AUTHORS.md file unchanged'; else if ! diff -q AUTHORS.md.tmp AUTHORS.md; then echo 'Updating AUTHORS.md:'; diff AUTHORS.md.tmp AUTHORS.md; mv AUTHORS.md.tmp AUTHORS.md; else echo 'AUTHORS.md was already up to date'; fi; fi"
sh -c "rm -f log.tmp AUTHORS.md.tmp"

.PHONY: clean
clean:
Expand Down

0 comments on commit ae421af

Please sign in to comment.