borg/.github/workflows/fame.yml
Thomas Waldmann 70fc87ec1b
CI: do not persist the checkout credentials where they are not needed
actions/checkout leaves the job token behind in .git/config, so anything
that later archives the workspace also archives the credential (zizmor's
artipacked audit).  None of these workflows push with it - release.yml
authenticates gh via GH_TOKEN, and peter-evans/create-pull-request uses
its own token input - so they can all opt out.

backport.yml is the exception and keeps the credentials: korthout/backport-action
pushes the backport branch with a plain `git push`, which only works with
what actions/checkout left in .git/config.  Marked accordingly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-29 22:37:28 +02:00

80 lines
2.7 KiB
YAML

# Refresh FAME.md and FAME.svg, the contributor summary generated by
# scripts/fame.py.
#
# The script needs the full history (it uses `git blame`), so this checks out
# with fetch-depth 0 and it always looks at master, no matter what triggered it.
# scripts/fame.py rewrites FAME.md only when the numbers actually changed, so a
# quiet week does not produce a pull request that only bumps the date.
#
# The pull request is created with GITHUB_TOKEN, so CI does not run on it - that
# is fine for generated files, but keep it in mind if this workflow ever starts
# touching code.
#
# Deliberately not triggered by pushes to FAME.md: the "Lines" column is blame
# of the current checkout, so it moves with almost every commit, and merging one
# of these pull requests would immediately produce the next one. Both files are
# always written by the same run, so they cannot drift apart on their own.
name: FAME
on:
schedule:
- cron: '17 4 * * 1' # Mondays at 04:17 UTC
workflow_dispatch: # Allow manual trigger
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: read
jobs:
fame:
name: Update FAME.md
# Forks would only open pull requests against themselves, so do not bother.
if: github.repository == 'borgbackup/borg'
runs-on: ubuntu-26.04
timeout-minutes: 60
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: master
fetch-depth: 0 # git blame needs the whole history
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.14'
- name: Install git-fame
run: |
python -m pip install --upgrade pip
pip install 'git-fame ~= 3.1'
- name: Regenerate FAME.md and FAME.svg
run: python scripts/fame.py
- name: Create pull request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
add-paths: |
FAME.md
FAME.svg
branch: auto/update-fame
delete-branch: true
commit-message: "FAME.md: update contributor statistics"
title: "FAME.md: update contributor statistics"
body: |
Automatic update of `FAME.md`, generated by `scripts/fame.py` from the
`master` branch with [git-fame](https://github.com/casperdcl/git-fame).
If a contributor shows up twice under different names or e-mail
addresses, fix it in `.mailmap` rather than in `FAME.md` - the file
here is overwritten on every run.