Track Stargazers (#1249)
* Webhook for when repo is starred * Send star data to google sheets to be saved * change event name to watch * Change message displayed on Discord * Update .github/workflows/main.yml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: UncleCode <unclecode@kidocode.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
13
.github/workflows/main.yml
vendored
13
.github/workflows/main.yml
vendored
@@ -9,16 +9,26 @@ on:
|
|||||||
types: [opened]
|
types: [opened]
|
||||||
discussion:
|
discussion:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
watch:
|
||||||
|
types: [started]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
notify-discord:
|
notify-discord:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Send to Google Apps Script (Stars only)
|
||||||
|
if: github.event_name == 'watch'
|
||||||
|
run: |
|
||||||
|
curl -fSs -X POST "${{ secrets.GOOGLE_SCRIPT_ENDPOINT }}" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{"url":"${{ github.event.sender.html_url }}"}'
|
||||||
- name: Set webhook based on event type
|
- name: Set webhook based on event type
|
||||||
id: set-webhook
|
id: set-webhook
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" == "discussion" ]; then
|
if [ "${{ github.event_name }}" == "discussion" ]; then
|
||||||
echo "webhook=${{ secrets.DISCORD_DISCUSSIONS_WEBHOOK }}" >> $GITHUB_OUTPUT
|
echo "webhook=${{ secrets.DISCORD_DISCUSSIONS_WEBHOOK }}" >> $GITHUB_OUTPUT
|
||||||
|
elif [ "${{ github.event_name }}" == "watch" ]; then
|
||||||
|
echo "webhook=${{ secrets.DISCORD_STAR_GAZERS }}" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "webhook=${{ secrets.DISCORD_WEBHOOK }}" >> $GITHUB_OUTPUT
|
echo "webhook=${{ secrets.DISCORD_WEBHOOK }}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
@@ -31,5 +41,6 @@ jobs:
|
|||||||
args: |
|
args: |
|
||||||
${{ github.event_name == 'issues' && format('📣 New issue created: **{0}** by {1} - {2}', github.event.issue.title, github.event.issue.user.login, github.event.issue.html_url) ||
|
${{ github.event_name == 'issues' && format('📣 New issue created: **{0}** by {1} - {2}', github.event.issue.title, github.event.issue.user.login, github.event.issue.html_url) ||
|
||||||
github.event_name == 'issue_comment' && format('💬 New comment on issue **{0}** by {1} - {2}', github.event.issue.title, github.event.comment.user.login, github.event.comment.html_url) ||
|
github.event_name == 'issue_comment' && format('💬 New comment on issue **{0}** by {1} - {2}', github.event.issue.title, github.event.comment.user.login, github.event.comment.html_url) ||
|
||||||
github.event_name == 'pull_request' && format('🔄 New PR opened: **{0}** by {1} - {2}', github.event.pull_request.title, github.event.pull_request.user.login, github.event.pull_request.html_url) ||
|
github.event_name == 'pull_request' && format('🔄 New PR opened: **{0}** by {1} - {2}', github.event.pull_request.title, github.event.pull_request.user.login, github.event.pull_request.html_url) ||
|
||||||
|
github.event_name == 'watch' && format('⭐ {0} starred Crawl4AI 🥳! Check out their profile: {1}', github.event.sender.login, github.event.sender.html_url) ||
|
||||||
format('💬 New discussion started: **{0}** by {1} - {2}', github.event.discussion.title, github.event.discussion.user.login, github.event.discussion.html_url) }}
|
format('💬 New discussion started: **{0}** by {1} - {2}', github.event.discussion.title, github.event.discussion.user.login, github.event.discussion.html_url) }}
|
||||||
|
|||||||
Reference in New Issue
Block a user