Skip to content

Commit

Permalink
chore: update GitHub Actions workflow for AUTHORS file
Browse files Browse the repository at this point in the history
- Enhanced the update-authors workflow to filter out bots and the repository owner from the contributors list.
- Updated the logic to sort contributors alphabetically for better readability.
- Improved the commit message and pull request body to reflect the changes made in the workflow.

These changes ensure a more accurate and organized representation of contributors in the AUTHORS file.
  • Loading branch information
tphakala committed Jan 14, 2025
1 parent edbe54e commit 9d31bc2
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/update-authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- cron: '0 0 1 * *' # Monthly
workflow_dispatch: # Manual trigger

permissions: # Add explicit permissions block at workflow level
permissions:
contents: write
pull-requests: write

Expand All @@ -19,14 +19,18 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }} # Explicitly set the token
token: ${{ secrets.GITHUB_TOKEN }}

- name: Update AUTHORS file
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Fetch all contributors using GitHub CLI
contributors=$(gh api repos/tphakala/birdnet-go/contributors --jq '.[].login')
# Fetch all contributors using GitHub CLI and filter out bots and owner
contributors=$(gh api repos/tphakala/birdnet-go/contributors --jq '.[].login' | \
grep -v "tphakala" | \
grep -v "dependabot\[bot\]" | \
grep -v "^bot-" | \
sort)
# Create new AUTHORS file
cat > AUTHORS << EOL
Expand All @@ -35,7 +39,7 @@ jobs:
Tomi P. Hakala
Contributors:
$(echo "$contributors" | grep -v "tphakala" | sed 's/^/@/')
$(echo "$contributors" | sed 's/^/@/')
Please let me know if you are missing from contributors list!
Expand All @@ -54,12 +58,17 @@ jobs:
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }} # Explicitly set the token
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'docs: update AUTHORS file with current contributors'
title: 'Update AUTHORS file'
body: |
Automatically updated AUTHORS file with current GitHub contributors.
Changes:
- Updated contributors list
- Excluded dependabot and other bots
- Sorted contributors alphabetically
This PR was created automatically by the update-authors workflow.
branch: update-authors
delete-branch: true

0 comments on commit 9d31bc2

Please sign in to comment.