From 08912b052dfd10c52c0390a6169a31cbc6af48d4 Mon Sep 17 00:00:00 2001 From: yzqzss Date: Mon, 19 Dec 2022 21:07:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E6=94=B6=E9=9B=86=202022=20?= =?UTF-8?q?=E7=9A=84=E5=B9=B4=E7=BB=88=E6=80=BB=E7=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 34 +++++++++++++++++++++++++ README.md | 6 ++++- main.py | 51 ++++++++++++++++++++++++++++++++++++++ metadata.md | 2 ++ 4 files changed, 92 insertions(+), 1 deletion(-) create mode 100755 .github/workflows/main.yml create mode 100644 main.py create mode 100644 metadata.md diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100755 index 0000000..9442d62 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,34 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ main ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2.3.0 + - name: Run a one-line script + run: python main.py + - name: Commit files + run: | + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Action" + git add . + git commit -m "gen README.md" + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 51b24bd..880c1cc 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ 链接后面的数字是我们对每个博客分配的博客ID,有什么用呢?自行探索其它仓库。 -**想要添加您的年终总结?请发 Issue 或有能力者自行编辑 metadata.md 并发PR(不需要填写博客ID)。** +**想要添加您的年终总结?请发 Issue 或编辑 metadata.md 发PR(不需要填写博客ID)。** --- @@ -18,3 +18,7 @@ - 待确定 --- + + +| Article | Blog\_ID | IA\_Archived | +| --- | --- | --- | diff --git a/main.py b/main.py new file mode 100644 index 0000000..bb5f93a --- /dev/null +++ b/main.py @@ -0,0 +1,51 @@ +import os + +flag = 0 +markdown = """# 2022年终总结 + + + +本项目将长期维护(直到2024年初),因为[以往的经验](https://t.me/blogrsslist/269)告诉我——有些博主的年终总结可能要[拖拉个半年才写得完](https://idealclover.top/archives/627/),还有些博主明明都年中了才写完了上一年的年终总结,又觉得不好意思[而自己把文章发布时间改成年初](https://github.com/saveweb/review-2021/commit/558ba32ef42025dd1bf2da31c2c1fb60e05e2524),掩耳盗铃。有趣有趣…… + +链接后面的数字是我们对每个博客分配的博客ID,有什么用呢?自行探索其它仓库。 + +**想要添加您的年终总结?请发 Issue 或编辑 metadata.md 发PR(不需要填写博客ID)。** + +--- + +### 相关链接: +| [Save The Web's Telegram Channel](https://t.me/saveweb) | [独立博客&播客全订阅's Telegram Channel](https://t.me/blogrsslist) | [Github Org](https://github.com/saveweb) +| --- | --- | --- | + +### 友情链接: +- 待确定 + +--- + +""" + +with open('metadata.md', 'r') as f: + file = f.read() +lines = file.splitlines() +header = lines[0:2] +# print(header) +# import sys +# sys.exit(0) +lines = set(lines[2:]) +lines.discard('') +lines = list(lines) +lines.sort() + +# with open('metadata.md', 'w') as f: +# for line in header: +# f.write(line+'\n') +# for line in lines: +# f.write(line+'\n') + +with open('README.md', 'w') as f: + f.write(markdown+'\n') + for line in header: + f.write(line+'\n') + lines = set(lines) + for line in lines: + f.write(line+'\n') diff --git a/metadata.md b/metadata.md new file mode 100644 index 0000000..7bb55aa --- /dev/null +++ b/metadata.md @@ -0,0 +1,2 @@ +| Article | Blog\_ID | IA\_Archived | +| --- | --- | --- |