From 8c39f5ff4b774347e44b008679aa30a3db776109 Mon Sep 17 00:00:00 2001 From: Diogo Matos Date: Tue, 8 Oct 2024 17:26:08 +0100 Subject: [PATCH] chore: set commit author to github actions bot --- .github/workflows/main.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 22e061e..9561c35 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,18 +36,13 @@ jobs: - name: Set up Node uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20.9.0 - name: Format Code with Prettier run: | npm ci npm run format - - name: Configure Git - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - - name: Get Most Active Contributors id: get_contributors run: | @@ -55,8 +50,15 @@ jobs: contributors=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ "https://api.github.com/repos/${{ github.repository }}/contributors?per_page=5") - # Extract the login names of the top contributors - echo "::set-output name=reviewers::$(echo $contributors | jq -r '.[].login' | tr '\n' ',')" + # Extract the login names of the top contributors, excluding the commit author + commit_author="${{ github.actor }}" + reviewers=$(echo $contributors | jq -r '.[].login' | grep -v "^$commit_author$" | tr '\n' ',') + + # Remove trailing comma if it exists + reviewers=${reviewers%,} + + # Set reviewers output + echo "::set-output name=reviewers::$reviewers" - name: Create Pull Request uses: peter-evans/create-pull-request@v5 @@ -74,3 +76,5 @@ jobs: labels: add activities, automated reviewers: ${{ steps.get_contributors.outputs.reviewers }} token: ${{ secrets.GITHUB_TOKEN }} + author: "github-actions[bot] " + committer: "github-actions[bot] "