Skip to content

Commit

Permalink
chore: set commit author to github actions bot
Browse files Browse the repository at this point in the history
  • Loading branch information
diogogmatos committed Oct 8, 2024
1 parent 84283e7 commit 8c39f5f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,29 @@ 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: |
# Fetch contributors using GitHub API
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
Expand All @@ -74,3 +76,5 @@ jobs:
labels: add activities, automated
reviewers: ${{ steps.get_contributors.outputs.reviewers }}
token: ${{ secrets.GITHUB_TOKEN }}
author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
committer: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"

0 comments on commit 8c39f5f

Please sign in to comment.