-
Notifications
You must be signed in to change notification settings - Fork 100
36 lines (30 loc) · 1.26 KB
/
update_credits.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 Credits upon opening PR
on:
pull_request:
types:
- opened
- synchronize
jobs:
update-credits:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Update Credits
run: |
contributor_name=$(jq -r '.pull_request.user.login' $GITHUB_EVENT_PATH)
pr_description=$(jq -r '.pull_request.body' $GITHUB_EVENT_PATH)
echo "### Timestamp:" >> .github/credits.md
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> .github/credits.md
echo "### Contributor:" >> .github/credits.md
echo "${{ github.event.pull_request.user.login }}" >> .github/credits.md
echo "#### PR Title:" >> .github/credits.md
echo "${{ github.event.pull_request.title }}" >> .github/credits.md
echo "############################################" >> .github/credits.md
git add .github/credits.md
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Update credits.md with contributor information" || exit 0
git push origin HEAD:<name-of-remote-branch>
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}