-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
bluebread
wants to merge
93
commits into
FDUCSLG:master
Choose a base branch
from
bluebread:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
增加了随机打卡时间的功能 #44
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
先说明我如何实现这个功能。
每一天打卡时,随机决定明天 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 分钟。真想实现完全随机的同学建议找其他家服务器,或是直接在自己的电脑上设定定时任务。