Skip to content

Commit

Permalink
Add GitHub Actions workflow for updating CONTRIBUTORS.md
Browse files Browse the repository at this point in the history
- Implemented a new GitHub Actions workflow named 'update-contributors' to automate the process of updating the CONTRIBUTORS.md file.
- Set up the workflow to run daily at 2am UTC and on demand via workflow_dispatch.
- Added steps to checkout the repository, install jq, update the CONTRIBUTORS.md file with contributors' GitHub usernames, and create a pull request.

Signed-off-by: urasakikeisuke <[email protected]>
  • Loading branch information
urasakikeisuke committed May 15, 2024
1 parent 1b393b8 commit 34bf5a5
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/update-contributors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update CONTRIBUTORS.md

on:
schedule:
- cron: '0 2 * * *' # Runs every day at 2am UTC
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup jq
uses: dcarbone/install-jq-action@v2

- name: Update CONTRIBUTORS.md
run: |
echo "# Contributors" > CONTRIBUTORS.md
p=1
while true; do
s=$(curl "https://api.github.com/repos/mapiv/pypcd4/contributors?page=$p") || break
[ "0" = $(echo $s | jq length) ] && break
echo $s | jq -r '.[] | "* " + .login + ""'
p=$((p+1))
done | sort -f | tee -a CONTRIBUTORS.md
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update CONTRIBUTORS.md
title: Update CONTRIBUTORS.md
body: |
This PR updates the list of contributors in CONTRIBUTORS.md.
This PR is automatically generated by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub Actions.
branch: update-contributors
add-paths: |
CONTRIBUTORS.md
labels: |
rd/chore

0 comments on commit 34bf5a5

Please sign in to comment.