-
Notifications
You must be signed in to change notification settings - Fork 23
36 lines (34 loc) · 1.27 KB
/
update-contributors.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Update Contributors
on:
schedule:
- cron: '0 9 * * *'
jobs:
update_contributors:
if: github.repository == 'kaigionrails/conference-app'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update JSON
run: |
gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
/repos/kaigionrails/conference-app/contributors \
| jq 'map(select(.login != "dependabot[bot]")) | map({login, html_url})' > contributors.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set Current Date Variable
run: |
# Capture the current date and time in ISO 8601 format
CURRENT_DATE=$(date +'%Y-%m-%d')
MESSAGE="Update contributors.json $CURRENT_DATE"
# Set the CURRENT_DATE as an environment variable
echo "MESSAGE=$MESSAGE" >> $GITHUB_ENV
- name: Create PR if list is updated
uses: peter-evans/create-pull-request@v7
with:
author: "Kaigi on Rails <[email protected]>"
committer: "Kaigi on Rails <[email protected]>"
commit-message: ${{ env.MESSAGE }}
delete-branch: true
title: ${{ env.MESSAGE }}
env:
TZ: 'Asia/Tokyo'