-
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (150 loc) · 5.47 KB
/
rss-notifier.yml
File metadata and controls
164 lines (150 loc) · 5.47 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
name: RSS Notifier
permissions: {}
on:
issues:
types:
- opened
jobs:
authorize:
runs-on: ubuntu-latest
outputs:
authorized: ${{ steps.authorize.outputs.result }}
steps:
- name: Authorize
id: authorize
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GH_BOT_TOKEN }}
result-encoding: string
script: |
// get issue
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
// get author
const author = issue.data.user.login;
// check if author is LizardByte-bot
if (author === 'LizardByte-bot') {
console.log('Author is LizardByte-bot');
} else {
console.log('Author is not LizardByte-bot');
return 'false';
}
// check if label is blog
const labels = issue.data.labels.map(label => label.name);
if (labels.includes('blog')) {
console.log('Label is blog');
} else {
console.log('Label is not blog');
return 'false';
}
return 'true';
discord:
if: needs.authorize.outputs.authorized == 'true'
needs: authorize
outputs:
post-url: "https://discord.com/channels/804382334370578482/804383203020374016"
runs-on: ubuntu-latest
steps:
- name: discord
uses: sarisia/actions-status-discord@b8381b25576cb341b2af39926ab42c5056cc44ed # v1.15.5
with:
avatar_url: ${{ vars.ORG_LOGO_URL }}256
color: 0x${{ vars.COLOR_HEX_GREEN }}
nodetail: true
nofail: false
title: ${{ github.event.issue.title }}
url: ${{ github.event.issue.body }}
username: ${{ secrets.DISCORD_USERNAME }}
webhook: ${{ secrets.DISCORD_ANNOUNCEMENT_WEBHOOK }}
facebook:
if: needs.authorize.outputs.authorized == 'true'
needs: authorize
outputs:
post-url: "https://www.facebook.com/LizardByteDev"
runs-on: ubuntu-latest
steps:
- name: facebook-post-action
uses: LizardByte/actions/actions/facebook_post@v2025.1221.31807
with:
page_id: ${{ secrets.FACEBOOK_PAGE_ID }}
access_token: ${{ secrets.FACEBOOK_ACCESS_TOKEN }}
message: ${{ github.event.issue.title }}
url: ${{ github.event.issue.body }}
reddit:
if: needs.authorize.outputs.authorized == 'true'
needs: authorize
outputs:
post-url: ${{ steps.post.outputs.postUrl }}
runs-on: ubuntu-latest
steps:
- name: reddit
id: post
uses: bluwy/release-for-reddit-action@b4ee0e0d64da893e0428912aac5cda675082bd85 # v2
with:
username: ${{ secrets.REDDIT_USERNAME }}
password: ${{ secrets.REDDIT_PASSWORD }}
app-id: ${{ secrets.REDDIT_CLIENT_ID }}
app-secret: ${{ secrets.REDDIT_CLIENT_SECRET }}
subreddit: ${{ vars.REDDIT_SUBREDDIT }}
title: ${{ github.event.issue.title }}
url: ${{ github.event.issue.body }}
flair-id: ${{ secrets.REDDIT_FLAIR_ID }} # https://www.reddit.com/r/<subreddit>>/api/link_flair.json
x:
if: needs.authorize.outputs.authorized == 'true'
needs: authorize
outputs:
post-url: "https://x.com/LizardByteDev"
runs-on: ubuntu-latest
steps:
- name: x
uses: nearform-actions/github-action-notify-twitter@b3fa623c2f320117e8a08e20564c4ce0a5e67930 # v1.2.3
# alternative: noweh/post-tweet-v2-action@v1.0
with:
message: "${{ github.event.issue.title }}: ${{ github.event.issue.body }}"
twitter-app-key: ${{ secrets.X_APP_KEY }}
twitter-app-secret: ${{ secrets.X_APP_SECRET }}
twitter-access-token: ${{ secrets.X_ACCESS_TOKEN }}
twitter-access-token-secret: ${{ secrets.X_ACCESS_TOKEN_SECRET }}
close-issue:
if: needs.authorize.outputs.authorized == 'true'
needs:
- authorize
- discord
- facebook
- reddit
- x
runs-on: ubuntu-latest
steps:
- name: Close issue
env:
GH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
run: |
get_emoji() {
if [ "$1" == "success" ]; then
echo ":white_check_mark:"
elif [ "$1" == "failure" ]; then
echo ":x:"
else
echo ":grey_question:"
fi
}
# Build comment as a single line with literal newlines
comment="| Job | Status | Post URL |
| --- |:------:| -------- |
| Discord | $(get_emoji "${{ needs.discord.result }}") | ${{ needs.discord.outputs.post-url }} |
| Facebook | $(get_emoji "${{ needs.facebook.result }}") | ${{ needs.facebook.outputs.post-url }} |
| Reddit | $(get_emoji "${{ needs.reddit.result }}") | ${{ needs.reddit.outputs.post-url }} |
| X | $(get_emoji "${{ needs.x.result }}") | ${{ needs.x.outputs.post-url }} |"
close_reason="completed"
lock_reason="resolved"
gh issue close ${{ github.event.issue.number }} \
--comment "${comment}" \
--reason "${close_reason}" \
--repo "${{ github.repository }}"
gh issue lock ${{ github.event.issue.number }} \
--reason "${lock_reason}" \
--repo "${{ github.repository }}"