-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [alanhe421] | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
custom: ["https://www.paypal.com/paypalme/alanhe421","https://www.buymeacoffee.com/alanhg","https://github.com/alanhe421/alfred-workflows/blob/master/wechat-award.jpg"] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## About | ||
|
||
just use `${{steps.repo-discussion.outputs.count}}` to get repo's discussion-count. | ||
|
||
### Example | ||
|
||
```yml | ||
... | ||
|
||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
watch: | ||
action: started | ||
|
||
steps: | ||
- name: Discussion Count | ||
id: repo-discussion | ||
uses: alanhe421/repo-discussion-count-action@master | ||
|
||
... | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,33 @@ | ||
name: 'Repo Star Count' | ||
description: 'Get count of Github repository stars' | ||
name: 'Repo Discussion Count' | ||
description: 'Get discussion count of Github repository' | ||
author: 'Alan He' | ||
inputs: | ||
repo: | ||
description: 'Repository Path' | ||
required: false | ||
default: ${{github.repository}} | ||
repoPath: | ||
description: 'Repository Path' | ||
required: false | ||
default: ${{github.repository}} | ||
token: | ||
description: 'GitHub Token' | ||
required: true | ||
outputs: | ||
discussionCount: | ||
description: "Repo Discussion Count" | ||
value: ${{ steps.repo-discussion.outputs.discussionCount }} # 确保这里的输出名称与下面的一致 | ||
runs: | ||
using: composite | ||
steps: | ||
- id: repo-discussion | ||
run: | | ||
star=`curl -s 'https://api.github.com/repos/${{repo}}?page=$i&per_page=100' | jq .stargazers_count` | ||
echo "repoStars=$star" >> $GITHUB_ENV | ||
OWNER=$(echo "${{ inputs.repoPath }}" | awk -F '/' '{print $1}') | ||
REPO=$(echo "${{ inputs.repoPath }}" | awk -F '/' '{print $2}') | ||
RESPONSE=$(curl -s -H "Authorization: bearer ${{ inputs.token }}" \ | ||
-X POST \ | ||
-H "Content-Type: application/json" \ | ||
-d "{\"query\": \"query { repository(owner: \\\"$OWNER\\\", name: \\\"$REPO\\\") { discussions { totalCount } } }\"}" \ | ||
https://api.github.com/graphql) | ||
COUNT=$(echo "$RESPONSE" | jq '.data.repository.discussions.totalCount') | ||
echo "discussionCount=$COUNT" >> $GITHUB_OUTPUT | ||
shell: bash | ||
branding: | ||
icon: 'award' | ||
color: 'blue' |