每天掘金自动签到 时间自定义,默认11:00
你好,我是若川。目前持续组织了5个月每周一起学200行左右源码共读活动,每周一期,已进行到20期,感兴趣的可以加我微信 ruochuan12 加群参与,长期交流学习。
在项目 settings => secrets
添加 JUEJIN_COOKIE
字段,设置值为掘金 cookie
,设置好可以手动触发一次,验证是否正确,下次就会定时触发了,再也不用担心签到了。
掘金 cookie
好像一个月内有效,退出登录后也无效,需要及时更换cookie
。
如图所示,就成功了。
获取 掘金 cookie
方法
在 fetch/xhr
搜索过滤 get_today_status
这个接口,在 Request Headers
中复制 cookie
的值。如下图所示:
添加 .github/workflows/main.yml
文件,其中 main
可以自定义成其他名称。
on:
push:
schedule:
# 定时任务 每天 11:00 自动签到,按照计划任务队列,可能延迟 3 + 8 = 北京时间 11
- cron: '00 3 * * *'
jobs:
juejin:
runs-on: ubuntu-latest
name: 掘金自动签到
steps:
- name: Hello world action step
id: hello
uses: lxchuan12/juejin-actions@main
env:
JUEJIN_COOKIE: ${{secrets.JUEJIN_COOKIE}}
with:
who-to-greet: '若川'
# Use the output from the `hello` step
- name: Get the output
run: |
echo "The time was ${{ steps.hello.outputs.time }}"
echo "签到结果: ${{ steps.hello.outputs.checkInResult }}"
同样在项目 settings => secrets
添加 JUEJIN_COOKIE
字段,设置值为掘金 cookie
。
# git clone https://github.com/lxchuan12/juejin-actions.git
npm i -g pnpm
pnpm install
在 test
文件夹新增 cookie.js
文件代码如下:
export const cookie = '你在掘金的cookie';
npm run test