Skip to content

Commit

Permalink
chore: improve scraper workflow (#240)
Browse files Browse the repository at this point in the history
* chore: improve scraper workflow

* chore: test

* feat: enable manual triggering of workflow

* chore: set bot as commit author & set most active contributor as reviewer

* chore: set commit author to github actions bot

* fix: remove bot from reviewers

* fix: i give up just use the biggest contributor

* fix: test

* chore: clean up for review

---------

Co-authored-by: Nuno Miguel <[email protected]>
  • Loading branch information
diogogmatos and nunom27 authored Oct 20, 2024
1 parent a8b6d34 commit 8b0f4fd
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
schedule:
# run every 7 days
- cron: "0 0 * * 0"
workflow_dispatch: # enables manual triggering

jobs:
build:
Expand Down Expand Up @@ -33,13 +34,23 @@ 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: 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=1")
# Extract the login names of the top contributors
echo "::set-output name=reviewers::$(echo $contributors | jq -r '.[].login' | tr '\n' ',')"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
Expand All @@ -51,7 +62,10 @@ jobs:
> Before merging, please be aware of edge cases where manual intervention is needed.
commit-message: "chore: update shifts data"
branch: action/shifts
base: master
delete-branch: true
labels: add activities, automated
reviewers: diogogmatos
reviewers: ${{ steps.get_contributors.outputs.reviewers }}
token: ${{ secrets.GITHUB_TOKEN }}
author: "GitHub <[email protected]>"
committer: "GitHub <[email protected]>"

0 comments on commit 8b0f4fd

Please sign in to comment.