@@ -11,65 +11,25 @@ jobs:
11
11
if : github.event_name == 'watch'
12
12
name : Notify Slack on star
13
13
runs-on : ubuntu-latest
14
- env :
15
- SLACK_CHANNEL_STARS : " CSK7N9TGX" # Define your star notification channel ID here
16
14
steps :
17
15
- name : Get current star count
18
16
run : |
19
- # Fetches the current number of stars for the repository
20
- # GITHUB_TOKEN is implicitly available to access public repo data;
21
- # for private repos, you might need to explicitly pass a token with read access.
22
- REPO_INFO_URL="https://api.github.com/repos/${{ github.repository }}"
23
- STARS_COUNT=$(curl --silent -H "Accept: application/vnd.github.v3+json" "${REPO_INFO_URL}" | jq '.stargazers_count')
24
- echo "STARS=${STARS_COUNT}" >> $GITHUB_ENV
25
- shell : bash
26
-
17
+ echo "STARS=$(curl --silent 'https://api.github.com/repos/${{ github.repository }}' -H 'Accept: application/vnd.github.preview' | jq '.stargazers_count')" >> $GITHUB_ENV
27
18
- name : Notify Slack
28
19
env :
29
20
SLACK_BOT_TOKEN : ${{ secrets.SLACK_BOT_TOKEN }}
30
21
uses : pullreminders/slack-action@master
31
22
with :
32
- args : |
33
- {
34
- "channel": "${{ env.SLACK_CHANNEL_STARS }}",
35
- "text": "${{ github.actor }} just starred ${{ github.repository }}! (<https://github.com/${{ github.repository }}/stargazers|See stargazers>) Total ⭐️: ${{ env.STARS }}"
36
- }
23
+ args : ' {\"channel\":\"CSK7N9TGX\",\"text\":\"${{ github.actor }} just starred ${{ github.repository }}! (https://github.com/${{ github.repository }}/stargazers) Total ⭐️: ${{ env.STARS }}\"}'
37
24
38
25
good-first-issue-notify :
39
- # Condition: Runs if the event is 'issues' AND the label added is 'good first issue' OR 'first-timers-only'
40
26
if : github.event_name == 'issues' && (github.event.label.name == 'good first issue' || github.event.label.name == 'first-timers-only')
41
27
name : Notify Slack for new good-first-issue
42
28
runs-on : ubuntu-latest
43
- env :
44
- SLACK_CHANNEL_ISSUES : " C019426UBNY" # Define your 'good first issue' channel ID here
45
29
steps :
46
30
- name : Notify Slack
47
31
env :
48
32
SLACK_BOT_TOKEN : ${{ secrets.SLACK_BOT_TOKEN }}
49
33
uses : pullreminders/slack-action@master
50
34
with :
51
- # This uses Slack's Block Kit for a richer message.
52
- # 'pullreminders/slack-action' passes these args directly to Slack's chat.postMessage API.
53
- args : |
54
- {
55
- "channel": "${{ env.SLACK_CHANNEL_ISSUES }}",
56
- "blocks": [
57
- {
58
- "type": "section",
59
- "text": {
60
- "type": "mrkdwn",
61
- "text": ":new: New `good first issue` in *${{ github.repository }}*:\n<${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"
62
- }
63
- },
64
- {
65
- "type": "context",
66
- "elements": [
67
- {
68
- "type": "mrkdwn",
69
- "text": "Labels: `${{ join(github.event.issue.labels.*.name, '`, `') }}`"
70
- }
71
- ]
72
- }
73
- ],
74
- "text": ":new: New good first issue in ${{ github.repository }}: ${{ github.event.issue.title }} - ${{ github.event.issue.html_url }}"
75
- }
35
+ args : ' {\"channel\":\"C019426UBNY\",\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":new: Good first issue up for grabs: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>\"}}'
0 commit comments