Skip to content

Merge pull request #80 from Cielquan/dependabot/pip/flask-gte-1.1.2-a… #56

Merge pull request #80 from Cielquan/dependabot/pip/flask-gte-1.1.2-a…

Merge pull request #80 from Cielquan/dependabot/pip/flask-gte-1.1.2-a… #56

---
name: Update AUTHORS.rst
# What this workflow does:
# 1. Update the AUTHORS.rst file
# 2. Git commit and push the file if there are changes.
on: # yamllint disable-line rule:truthy
workflow_dispatch:
push:
tags:
- "!*"
branches:
- main
- "test-me-*"
jobs:
update-authors:
name: Update AUTHORS.rst file
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
- name: Update AUTHORS.rst file
shell: python
run: |
import subprocess
git_authors = subprocess.run(
["git", "log", "--format=%aN <%aE>"], capture_output=True, check=True
).stdout.decode()
skip_list = (
"Christian Riedel",
"dependabot",
"pre-commit-ci",
"github-action",
"GitHub Actions",
)
authors = [
author
for author in set(git_authors.strip().split("\n"))
if not author.startswith(skip_list)
]
authors.sort()
file_head = (
".. This file is automatically generated/updated by a github actions workflow.\n"
".. Every manual change will be overwritten on push to main.\n"
".. You can find it here: ``.github/workflows/update-authors.yaml``\n"
".. For more information see "
"`https://github.com/rstcheck/rstcheck/graphs/contributors`\n\n"
"Author\n"
"------\n"
"Christian Riedel <cielquan@protonmail.com>\n\n"
"Additional contributions by (sorted by name)\n"
"--------------------------------------------\n"
)
with open("AUTHORS.rst", "w") as authors_file:
authors_file.write(file_head)
if len(authors) > 0:
authors_file.write("- ")
authors_file.write("\n- ".join(authors))
authors_file.write("\n")
- name: Check if diff
continue-on-error: true
run: >
git diff --exit-code AUTHORS.rst &&
(echo "### No update" && exit 1) || (echo "### Commit update")
- uses: EndBug/add-and-commit@v9
name: Commit and push if diff
if: success()
with:
add: AUTHORS.rst
message: Update AUTHORS.rst file with new author(s)
author_name: GitHub Actions
author_email: action@github.com
committer_name: GitHub Actions
committer_email: actions@github.com
push: true