From 9d31bc29c88fe8647698971311d36bca26f64839 Mon Sep 17 00:00:00 2001 From: "Tomi P. Hakala" Date: Tue, 14 Jan 2025 19:59:30 +0200 Subject: [PATCH] chore: update GitHub Actions workflow for AUTHORS file - 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. --- .github/workflows/update-authors.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update-authors.yml b/.github/workflows/update-authors.yml index a388148..6535e26 100644 --- a/.github/workflows/update-authors.yml +++ b/.github/workflows/update-authors.yml @@ -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 @@ -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 @@ -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! @@ -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 \ No newline at end of file