forked from featbit/featbit
-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (39 loc) · 1.7 KB
/
contribution.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
37
38
39
40
41
42
43
name: Contribution
on:
workflow_dispatch:
push:
branches:
- main
jobs:
Contribution:
name: Contribution
runs-on: ubuntu-latest
steps:
- uses: 8BitJonny/[email protected]
id: PR
- name: Extract log items
if: steps.PR.outputs.number != ''
env:
PR: ${{steps.PR.outputs.pr}}
run: |
contributor="${{fromJson(steps.PR.outputs.pr).user.login}}"
contributor_profile="${{fromJson(steps.PR.outputs.pr).user.html_url}}"
pr_url="${{fromJson(steps.PR.outputs.pr).html_url}}"
points=$(echo $PR | jq '.labels[]|select(.name|startswith("points"))' | jq '.name' | tr -d '"' | cut -d ':' -f 2)
echo "contributor_profile=$contributor_profile" >> $GITHUB_ENV
echo "pr_url=$pr_url" >> $GITHUB_ENV
echo "points=$points" >> $GITHUB_ENV
echo "now=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
echo "contributor=$contributor" >> $GITHUB_ENV
- name: Log contribution to worksheet
if: ${{steps.PR.outputs.number != '' && env.points > 0}}
uses: jroehl/[email protected]
with:
spreadsheetId: 1ukyXgi_jRPeXj7EAST0IrnPfLOQ6xDBkcyAJY9N-Yb4
commands: | # list of commands, specified as a valid JSON string
[
{ "command": "appendData", "args": { "worksheetTitle": "data", "data": [["${{env.contributor}}", "${{env.contributor_profile}}", "${{ github.event.repository.name }}", ${{env.points}}, "${{env.now}}", "${{env.pr_url}}"]], "minCol": 1 } }
]
env:
GSHEET_CLIENT_EMAIL: ${{ secrets.GSHEET_CLIENT_EMAIL }}
GSHEET_PRIVATE_KEY: ${{ secrets.GSHEET_PRIVATE_KEY }}