forked from actions-integration/checkin
-
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
0 parents
commit 20e7786
Showing
7 changed files
with
118 additions
and
0 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,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[Makefile] | ||
indent_style = tab |
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,21 @@ | ||
name: run | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
schedule: | ||
- cron: 10 16 * * * | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- run: npm ci | ||
- run: npm run main | ||
env: | ||
GLADOS: ${{ secrets.GLADOS }} | ||
NOTIFY: ${{ secrets.NOTIFY }} |
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 @@ | ||
node_modules |
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,52 @@ | ||
const glados = async () => { | ||
const cookie = process.env.GLADOS | ||
if (!cookie) return | ||
try { | ||
const headers = { | ||
'cookie': cookie, | ||
'referer': 'https://glados.rocks/console/checkin', | ||
'user-agent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)', | ||
} | ||
const checkin = await fetch('https://glados.rocks/api/user/checkin', { | ||
method: 'POST', | ||
headers: { ...headers, 'content-type': 'application/json' }, | ||
body: '{"token":"glados.network"}', | ||
}).then((r) => r.json()) | ||
const status = await fetch('https://glados.rocks/api/user/status', { | ||
method: 'GET', | ||
headers, | ||
}).then((r) => r.json()) | ||
return [ | ||
'Checkin OK', | ||
`${checkin.message}`, | ||
`Left Days ${Number(status.data.leftDays)}`, | ||
] | ||
} catch (error) { | ||
return [ | ||
'Checkin Error', | ||
`${error}`, | ||
`<${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}>`, | ||
] | ||
} | ||
} | ||
|
||
const notify = async (contents) => { | ||
const token = process.env.NOTIFY | ||
if (!token || !contents) return | ||
await fetch(`https://www.pushplus.plus/send`, { | ||
method: 'POST', | ||
headers: { 'content-type': 'application/json' }, | ||
body: JSON.stringify({ | ||
token, | ||
title: contents[0], | ||
content: contents.join('<br>'), | ||
template: 'markdown', | ||
}), | ||
}) | ||
} | ||
|
||
const main = async () => { | ||
await notify(await glados()) | ||
} | ||
|
||
main() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 @@ | ||
{ | ||
"type": "module", | ||
"scripts": { | ||
"main": "node main.js" | ||
} | ||
} |
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,20 @@ | ||
# Checkin | ||
|
||
GitHub Actions 实现 [GLaDOS][glados] 自动签到 | ||
|
||
([GLaDOS][glados] 可用邀请码: `MW4DK-O0RSF-C7AOU-EN1MP`, 双方都有奖励天数) | ||
|
||
## 使用说明 | ||
|
||
1. Fork 这个仓库 | ||
|
||
1. 登录 [GLaDOS][glados] 获取 Cookie | ||
|
||
1. 添加 Cookie 到 Secret `GLADOS` | ||
|
||
1. 启用 Actions, 每天北京时间 00:10 自动签到 | ||
|
||
1. 如需推送通知, 可用 [PushPlus][pushplus], 添加 Token 到 Secret `NOTIFY` | ||
|
||
[glados]: https://github.com/glados-network/GLaDOS | ||
[pushplus]: https://www.pushplus.plus/ |