Hello World

This commit is contained in:
GitHub Actions
2022-06-30 02:18:52 +00:00
commit cd995d7629
2562 changed files with 457732 additions and 0 deletions

13
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

31
.github/ISSUE_TEMPLATE/Question.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: Question 问题
description: 提出你的疑惑🤔
title: "Q: "
labels: question
body:
- type: markdown
attributes:
value: |
发表issues时请记住: 这是真的吗?有必要吗?是善良的吗?
- type: textarea
id: repro
attributes:
label: 详细说明
description: 直接的诉说出你的疑问和担忧( ͡° ͜ʖ ͡°)
value: |
什么:
怎么:
为什么:
render: bash
validations:
required: true
- type: checkboxes
id: cat-preferences
attributes:
label: 这里有一些承诺需要阅读
options:
- label: 我会广泛传播这个项目
- label: 这是我深思熟虑提出的问题
required: true
- label: 我承诺遵守社区指导方针
required: true

61
.github/ISSUE_TEMPLATE/bug.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
name: Bug 报告
description: 反馈关于订阅链接的错误
title: "B: "
labels: bug
body:
- type: markdown
attributes:
value: |
请简练,概括的提出你的问题并写到上方的输入框内( ͡° ͜ʖ ͡°)同时也请通过搜索确认是否有人提出过相同问题。
- type: input
id: bug-url
attributes:
label: 出现问题的订阅链接
description: 告诉我你使用的哪个订阅链接出现问题了🤔(包括旧的订阅链接)
placeholder: https://openit.ml/example
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: 你使用的是哪个应用程序?
description: 可多选,不在范围内的和选择路由器的请在下方详细描述.
multiple: true
options:
- SS
- SSR
- 魔改ss
- v2rayN
- v2rayNG
- Shadowrocket
- Quantumult X
- ClashX
- Clash for Windows
- Clash for Android
- Stash
- Surge
- Qv2ray
- Matsuri
- OneClick
- SagerNet
- Kitsunebi
- Surfboard
- passwall
- openclash
- helloworld
- shadowsocksR Plus+
validations:
required: false
- type: textarea
id: repro
attributes:
label: 复现方式
description: "你如何触发这个错误?请一步一步地指导我们完成它."
value: |
1.
2.
3.
...
render: bash
validations:
required: true

11
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
blank_issues_enabled: true
contact_links:
- name: Openit Support
url: https://t.me/yusteven
about: 获得关于节点 / 订阅使用方面的支持 Telegram 24h人工客服💁
- name: ShareCentrePro Channel
url: https://t.me/ShareCentrePro
about: 想获取我们的最新消息?欢迎加入 Telegram 的 ShareCentrePro
- name: ShareCentrePro Group
url: https://t.me/woisx
about: 想与志同道合的伙伴们交流一下( ͡° ͜ʖ ͡°)欢迎加入 Telegram 的 ShareCentre Pro || Chat

17
.github/ISSUE_TEMPLATE/future.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Feature 请求
description: 为这个项目提出一个建议
title: "F: "
labels: enhancement
body:
- type: markdown
attributes:
value: |
发表一个独特的建议
- type: textarea
id: repro
attributes:
label: 详细说明
description: 尽可能的详细说明,不限字数( ͡° ͜ʖ ͡°)
render: bash
validations:
required: true

11
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"

8
.github/update-repo.sh vendored Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
status_log=$(git status -sb)
# 这里使用的是 main 分支,根据需求自行修改
if [ "$status_log" == "## main...origin/main" ];then
echo -e "\033[42;30m nothing to commit, working tree clean \033[0m"
else
git pull origin main && git add . && git commit -m "$(date '+%Y.%m.%d %H:%M:%S') 更新订阅" && git push origin main
fi

6
.github/url.sh vendored Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
name=Openit
line=`sed -n '$=' url`
time=`date "+%Y.%m.%d %H:%M:%S"`
echo -e "REMARKS=$name \nSTATUS=节点数量: $line.♥.更新时间: $time"

10
.github/workflows/Clash.yaml vendored Normal file
View File

@@ -0,0 +1,10 @@
name: Clash
on:
workflow_dispatch:
jobs:
my-job:
name: sleep
runs-on: ubuntu-latest
steps:
- name: curl
run: curl https://github.com/git-yusteven/openit

151
.github/workflows/Nodes.yaml vendored Normal file
View File

@@ -0,0 +1,151 @@
name: Nodes
on:
schedule: #これは UTC+0 #これは UTC+8
- cron: '*/34 0-8 * * 1-5' #工作日 上午8:00 - 下午4:00
- cron: '*/24 8-14 * * 1-5' #工作日 下午4:00 - 下午10:00
- cron: '*/54 14-21 * * 1-5' #工作日 下午10:00 - 次日凌晨5:00
- cron: '*/24 21-23 * * 1-5' #工作日 次日凌晨5:00 - 次日上午8:00
- cron: '*/24 * * * 0,6' #休息日 全天候
workflow_dispatch: #手动调试按钮
jobs:
re-job:
name: Reuse
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 #git clone
- name: init
run: | #配置git上传用户名和邮箱
git config pull.rebase false
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
- name: pool.yaml
run: | #input./utils/pool/pool
./utils/subconverter/subconverter -g --artifact "pool"
sed -i '1,6d' ./utils/subconverter/pool.yaml #删除pool.yaml开头1-6行
mv ./utils/subconverter/pool.yaml ./utils/pool/pool.yaml
- run: ./.github/update-repo.sh || true #output./utils/pool/pool.yaml
cs-job: #input./utils/pool/config.yaml ./utils/clashcheck/config.yaml
name: Collecting & Speedtest
needs: re-job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 #git clone
- uses: actions/setup-python@v4 #python环境
with:
python-version: '3.x'
cache: 'pip'
- name: Timezone #UTC+0 → UTC+8
run: sudo timedatectl set-timezone 'Asia/Shanghai'
- name: init
run: | #配置git上传用户名和邮箱
git config pull.rebase false
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
- name: requirements.txt
run: | #安装python包
pip install -r ./utils/pool/requirements.txt
pip install -r ./utils/clashcheck/requirements.txt
- name: pool #input./utils/pool/config.yaml
run: cd ./utils/pool/ && timeout -k 30s 15m python main.py || true #output./utils/pool/output.yaml
- name: copy
run: cp ./utils/pool/output.yaml ./utils/clashcheck/input.yaml
- name: clashcheck #input./utils/clashcheck/config.yaml
run: cd ./utils/clashcheck/ && python main.py && python main.py && python main.py #output./utils/clashcheck/check.yaml
- run: ./.github/update-repo.sh || true #output./utils/pool/output.yaml ./utils/clashcheck/input.yaml ./utils/clashcheck/check.yaml
rr-job: #input./utils/clashcheck/check.yaml
name: Remove & Remark
needs: cs-job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 #git clone
- uses: actions/setup-node@v3 #Node.js环境
with:
node-version: 16
- name: Timezone #UTC+0 → UTC+8
run: sudo timedatectl set-timezone 'Asia/Shanghai'
- name: init
run: | #配置git上传用户名、邮箱和安装npm包
git config pull.rebase false
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
cd ./utils/rm/ && npm ci
- name: subconverter #input./utils/clashcheck/check.yaml
run: ./utils/subconverter/subconverter -g --artifact "rm" #output./utils/subconverter/rm1
- name: Remove & Remark
run: | #input./utils/subconverter/rm1
mv ./utils/subconverter/rm1 ./utils/rm/rm1
cd ./utils/rm/
#input./utils/rm/rm1
base64 -d rm1 > rm2 #output./utils/rm/rm2
#input./utils/rm/rm2
npm start #output./utils/rm/out
- name: url & https & check
run: | #input./utils/rm/url ./url ./.github/url.sh ./1 ./2 ./3
rm ./utils/rm/rm1 ./utils/rm/rm2 #./utils/rm/out #./utils/rm/config.yml #清理垃圾
#input./utils/rm/out
mv ./utils/rm/out ./url #output./url
#input./url
base64 ./url > ./utils/pool/check -w 0 #output./utils/pool/check
#input./.github/url.sh
./.github/url.sh > ./1 #output./1
#input./url
cp ./url ./2 #output./2
#input./1 ./2
cat 1 2 > 3 && rm 1 2 #output./3
#input./3
base64 3 > https -w 0 && rm 3 #output./https
- run: ./.github/update-repo.sh || true #output./url ./https ./utils/pool/check
et-job: #input./utils/pool/check ./utils/pool/pool
name: Encode & Translate
needs: rr-job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 #git clone
- name: Timezone #UTC+0 → UTC+8
run: sudo timedatectl set-timezone 'Asia/Shanghai'
- name: init
run: |
git config pull.rebase false
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
- name: subconverter
run: | #input./utils/pool/check ./utils/pool/pool ./utils/clashcheck/check.yaml
./utils/subconverter/subconverter -g
#output./utils/subconverter/long ./utils/subconverter/Clash.yaml ./utils/subconverter/pool.yaml ./utils/subconverter/rm1
mv ./utils/subconverter/long ./long || true
mv ./utils/subconverter/Clash.yaml ./Clash.yaml || true
rm ./utils/subconverter/pool.yaml ./utils/subconverter/rm1
- run: ./.github/update-repo.sh || true #output./long ./Clash.yaml
long: #jsdelivr CDN同步
needs: et-job
runs-on: ubuntu-latest
steps:
- name: CDN
run: curl https://purge.jsdelivr.net/gh/yu-steven/openit@main/long
HTTPS: #jsdelivr CDN同步
needs: et-job
runs-on: ubuntu-latest
steps:
- name: CDN
run: curl https://purge.jsdelivr.net/gh/yu-steven/openit@main/https
Clash: #jsdelivr CDN同步
needs: et-job
runs-on: ubuntu-latest
steps:
- name: CDN
run: curl https://purge.jsdelivr.net/gh/yu-steven/openit@main/Clash.yaml
Quanx: #jsdelivr CDN同步
needs: et-job
runs-on: ubuntu-latest
steps:
- name: CDN
run: curl https://purge.jsdelivr.net/gh/yu-steven/openit@main/Quanx.conf

26
.github/workflows/Reuse.yaml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Reuse
on:
push:
paths:
- 'url'
workflow_dispatch:
jobs:
bf-job:
name: Reuse
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Timezone
run: sudo timedatectl set-timezone 'Asia/Shanghai'
- name: git init
run: |
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
- name: pool
run: | #sed -n '/:\/\//p' bot >> ./openit/url #提取bot文本中符合行中有://字符的行追加到url文本结尾
sed -i 's/^[ \t]*//g' url #删除行头空格和tab对齐行头
sed -i '/^sub:/d' url #删除以sub:开头的行
sed -i '/^$/d' url #删除空白行
sed -i -r '/^\s*$/d' url #删除带有空格或制表符的空行
base64 ./url > ./utils/pool/pool -w 0
- run: ./.github/update-repo.sh

47
.github/workflows/crontab.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: crontab
# 触发条件
on:
schedule:
# - cron: '0 3,12 * * *'
# 表达式生成 https://crontab.guru/
- cron: '*/20 0-15 * * *'
workflow_dispatch:
env: # 设置环境变量
TZ: Asia/Shanghai
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/run_in_Actions/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Timezone
run: sudo timedatectl set-timezone 'Asia/Shanghai'
- name: requirements
run: |
pip install -r ./utils/freev2/requirements.txt
- name: main.py
run: |
python ./utils/freev2/main.py
- name: Push
run: |
git pull origin main
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add ./sub
git add ./utils
git commit -m "$(date '+%Y.%m.%d %H:%M:%S') 更新机场订阅" || true
git push origin main || true

13
.github/workflows/ip.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: ip
on:
workflow_dispatch:
jobs:
Collecting:
runs-on: ubuntu-latest
steps:
- name: ifconfig.me
run: |
curl ifconfig.me
- name: ipinfo.io
run: |
curl ipinfo.io

24
.github/workflows/zz.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: zz
on:
# schedule:
# - cron: "* * * * 0"
workflow_dispatch:
jobs:
zz-job:
name: Delete History
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: init
run: |
git config pull.rebase false
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
- run: |
git checkout --orphan latest_branch
git add -A
git commit -am "Hello World"
git branch -D main
git branch -m main
git push -f origin main

154
.github/说明文档.md vendored Normal file
View File

@@ -0,0 +1,154 @@
# Workflow的具体实现
## CDN具体实现
首先常规步骤然后用Linux系统的curl命令访问jsdelivr的更新CDN地址脚本里有
然后用cron命令定时(这里有个方便的在线小工具测试定时是否符合期望https://tooltt.com/crontab/) 我定时每天从每小时的第5分钟开始每20分钟执行一次
然后添加一个触发按钮`workflow_dispatch`用于调试 [如图](#调试时点击绿框直接运行)
#### 具体实现
```
name: CDN
on:
schedule:
- cron: "5/20 * * * *"
workflow_dispatch:
jobs:
my-job:
name: jsdelivr
runs-on: ubuntu-latest
steps:
- name: long
run: curl https://purge.jsdelivr.net/gh/git-yusteven/openit@main/long
- name: Clash.yaml
run: curl https://purge.jsdelivr.net/gh/git-yusteven/openit@main/Clash.yaml
```
## Base64 Encode 具体实现
通过对某一个或几个项目的更改自动化把文件base64编码并输出
不用一个个复制,最后给出全部代码
### 首先设定环境
1. 设定触发条件特定几个文件写在paths下方xxx处或者某些文件不要定时运行(后文给出原因),最好加上手动触发`workflow_dispatch:`放在xxx的下一行与push对齐以备调试所用
[如图](#调试时点击绿框直接运行)
```
name: xxx
on:
push:
paths:
- 'xxx'
workflow_dispatch:
```
2. ubuntu系统即可代码给出的是持续最新版ubuntu
```
jobs:
my-job:
name: xxx
runs-on: ubuntu-latest
```
3. 使用官方`actions/checkout@v3`命令检出代码(v1的改良版v1用到了指针的概念不易懂)
```
- uses: actions/checkout@v3
```
4. 配置git注意把邮箱和名字改成自己GitHub的邮箱和名字引号内添加此处默认GitHub action
```
# 配置 git
- name: config git
run: git config --global user.email "actions@github.com"
git config --global user.name "GitHub Action"
```
### 其次修改仓库文件
**只需使用Linux上的命令修改文件即可不用去考虑cd到仓库文件夹**
```
- name: xxxx
run: 具体的命令,也可以是脚本
```
### 最后上传文件
这里有两种方式分为手动推送或者运行一个bash脚本下面给出详细解释
#### 其一,手动推送
<br>①检查change了什么文件
<br>②将文件提交到缓存区
<br>③给要上传的文件一个备注(不是名字)
<br>④push上传
```
- name: check for changes
run: git status
- name: stage changed files
run: git add .
- name: commit changed files
run: git commit -m "By Github actions"
- name: push code to main
run: git push
````
#### 其二 运行一个bash脚本
理想情况是修改、提交、推送,但是或许存在一些情况,导致其实文件没有发生变化。如果这时执行`git commit`,会提示`nothing to commit, working tree clean`
<br>注意了,这是一个报错,意味着 action 执行失败,会出现一个红叉❌,注意避免分支运行此Action,会报错`error: src refspec main does not match any`
<br>这里提供了一个bash脚本需要放在仓库中建议命名为`update-repo.sh`
```
#!/bin/bash
status_log=$(git status -sb)
# 这里使用的是 main 分支,根据需求自行修改
if [ "$status_log" == "## main...origin/main" ];then
echo "nothing to commit, working tree clean"
else
git add .&&git commit -m "By GitHub Action"&&git push origin main
fi
```
然后action脚本里这样写
```
- name: <!--上方的四件套或者下方命令运行bash脚本两者选其一,update-repo.sh为上述bash文件名-->run script
run: chmod +x ./update-repo.sh&&./update-repo.sh
```
#### 具体实现
```
name: xxx
on:
push:
paths:
- 'xxx'
workflow_dispatch:
jobs:
my-job:
name: xxx
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: config git
run: git config --global user.email "actions@github.com"
git config --global user.name "GitHub Action"
- name: xxxx
run: 具体的命令
- name: <!--下方是四件套-->check for changes
run: git status
- name: stage changed files
run: git add .
- name: commit changed files
run: git commit -m "By GitHub Action"
- name: push code
run: git push
- name: <!--上方的四件套或者下方命令运行bash脚本两者选其一,update-repo.sh为上述bash文件名-->run script
run: chmod +x ./update-repo.sh&&./update-repo.sh
```
官方actions/checkout说明文档https://github.com/actions/checkout
参考https://juejin.cn/post/6875857705282568200
来源:稀土掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
## 如何创建密钥
新建一个Token(workflows权限,其他权限自行斟酌)添加到仓库密钥区
在这里新建一个Token指路链接https://github.com/settings/tokens
在这里添加到仓库密钥区指路链接https://github.com/您的名字/您的仓库名/settings/secrets/actions/new
##### 调试时,点击绿框直接运行
##### [返回到CDN](#cdn具体实现) /// [返回到Base64](#base64-encode-具体实现)
![workflows](https://github.com/git-yusteven/openit/raw/main/images/workflows.jpg)