Skip to content

Commit

Permalink
add schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
wjz304 committed Aug 4, 2022
1 parent 97d5d35 commit ae7d26f
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,18 @@ jobs:
redpill-load/user_config.json
redpill-load/images/*.img
- name: Generate release tag
if: steps.info.outputs.iscustom == 'false'
run: |
if [ ${{ steps.info.outputs.issues }} == 'true' ]; then
echo "### ${{ env.issueauth }}'s Redpill Custom" >> $GITHUB_STEP_SUMMARY
else
echo "### $(echo "$GITHUB_REPOSITORY" | awk -F / '{print $1}')'s Redpill Custom" >> $GITHUB_STEP_SUMMARY
fi
echo "😞 😔 😟 😕 🙁 ☹️ 😣 😖 😫 😩 🥺 😢 " >> $GITHUB_STEP_SUMMARY
echo "您自定义 Redpill 所填写的信息无法解析, 请参考模板并请重新发起定制。 " >> $GITHUB_STEP_SUMMARY
echo "error info: ${{ steps.info.outputs.errinfo }} " >> $GITHUB_STEP_SUMMARY
- name: Create Issues Comment
if: steps.info.outputs.issues == 'true' && steps.info.outputs.iscustom == 'true' && success()
uses: actions-cool/issues-helper@v3
Expand Down Expand Up @@ -720,3 +732,4 @@ jobs:
Your customized Redpill build failed. Please click the URL below to view the details. Please close this issue by yourself and re create an issue after adjustment to initiate the rebuild.
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
emoji: hooray

91 changes: 91 additions & 0 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#
# Copyright (C) 2022 Ing <https://github.com/wjz304>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#


# 默认情况下,使用存储库的GITHUB_TOKEN执行任务时,GITHUB_TOKEN触发的事件不会创建新的工作流运行。这可以防止意外创建递归工作流运行。
# 可以通过个人TOKEN在工作流运行中触发工作流。
# 1. 在 https://github.com/settings/tokens 创建 一个 token
# 2. 在 https://github.com/${{ github.repository }}/settings/secrets/actions 加入上一步创建的 token


name: Redpill Build (schedule)

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:


jobs:
matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@main

- name: Find schedule issues
id: find-issues
uses: actions-cool/issues-helper@v3
with:
actions: 'find-issues'
token: ${{ secrets.GITHUB_TOKEN }}
issue-state: 'all'
#title-includes: 'custom'
labels: 'schedule'

- name: Get Issues Info
id: get-issues
uses: actions/github-script@v6
with:
script: |
var issues = ${{ toJSON(steps.find-issues.outputs.issues) }};
// '<???>': 替换一次; '/<???>/g': 替换全局; '/<???>/gi': 替换全局并忽略大小写;
issues = issues.replace(/\u0008/g, ""); // \b Backspace
issues = issues.replace(/\u0009/g, ""); // \t Tab
issues = issues.replace(/\u000A/g, ""); // \n 换行符
issues = issues.replace(/\u000B/g, ""); // \v 垂直制表符
issues = issues.replace(/\u000C/g, ""); // \f 换页
issues = issues.replace(/\u000D/g, ""); // \r 回车
//issues = issues.replace(/\u0022/g, ""); // \" 双引号 (")
//issues = issues.replace(/\u0027/g, ""); // \' 单引号 (')
//issues = issues.replace(/\u005C/g, ""); // \\ 反斜杠 (\)
issues = issues.replace(/\u00A0/g, ""); // 不间断空格
issues = issues.replace(/\u2028/g, ""); // 行分隔符
issues = issues.replace(/\u2029/g, ""); // 段落分隔符
issues = issues.replace(/\uFEFF/g, ""); // 字节顺序标记
core.setOutput("issues", JSON.stringify(issues));
- name: Reopen Issues
uses: jannekem/[email protected]
with:
script: |
import os, json, requests
if __name__ == '__main__':
try:
issues = {}
issues = json.loads(${{ steps.get-issues.outputs.issues }})
if len(issues) > 0:
headers = {'Accept': 'application/vnd.github+json', 'Authorization': 'token ${{ secrets.ISSUES }}'}
data = '{"state": "open"}'
for item in issues:
try:
url='https://api.github.com/repos/{}/issues/{}'.format('${{ github.repository }}', item['number'])
res = requests.post(url=url, data=data, headers=headers)
print(url)
print(res.json())
except:
pass
except Exception as err:
print(err)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
2. 构建失败 后请调整参数重新创建Issues发起重新构建, 或者修改body后 Close Issue + Reopen 重新触发。(触发编译:open, reopen)。
3. ext 存在兼容性问题, 添加是请与型号和版本对应, 并酌情添加 (不恰当的例子:r8125 不支持 DS920+ 的 7.0.1-42218 版本, 添加会编译失败)
4. 再次构建,直接 reopen 会再次触发构建。
5. 打上 'schedule' 标签 将会每日构建(通过Reopen的方式, 因此如果构建失败Issues没有Closed 将终止).

方式二:
fork 本项目 通过 Actions 填写相关参数进行构建。
Expand Down

0 comments on commit ae7d26f

Please sign in to comment.