Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加了随机打卡时间的功能 #44

Open
wants to merge 93 commits into
base: master
Choose a base branch
from

Conversation

bluebread
Copy link

先说明我如何实现这个功能。

每一天打卡时,随机决定明天 8 am 到 2 pm 之间何时打卡,纪录时间到 timestamp.txt (这个文件在代码仓库里,因此更新文件需要 Commit & Push 到 Github 仓库)。
设定 workflow 从每天 8 点到下午 4 点,每隔一个小时检查一次当前时间是否超过 timestamp.txt 纪录的时间。如果尚未超过,workflow 直接结束;否则,打卡,更新 timestamp.txt。
因为 Github 不会完全按照你设定的时间执行 Action ,延迟一个小时以上是很常见的,所以 2pm 后我设定多打卡两次,以防万一。

之前看 issue#9 有人讨论过这个功能。一种方案 sleep 随机一段很长的时间(e.g 六七个小时)再打卡,但是对大部分依赖 Github Actions 每月免费额度的同学而言不太现实。

我的方案不一定是最好,但试了几天能用(主要是前几天被查水表,一怒之下把东西写了哈哈),消耗的每月免费额度也不多,估计每月 100 分钟。真想实现完全随机的同学建议找其他家服务器,或是直接在自己的电脑上设定定时任务。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant