-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 变量和格式错误,修复python3.12下autopep8对f字符串的错误格式化
- Loading branch information
Showing
8 changed files
with
646 additions
and
909 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,16 +7,50 @@ on: | |
- 'setHosts_Classic.py' | ||
- 'requirements.txt' | ||
branches: | ||
- 'main' | ||
- 'master' | ||
schedule: | ||
- cron: '0 */4 * * *' | ||
workflow_dispatch: # 允许手动触发 | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
format-fix: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install formatting tools | ||
run: | | ||
pip install black flake8 isort | ||
- name: Run and fix formatting | ||
run: | | ||
black . | ||
isort . | ||
flake8 --ignore=E501,W503,E203 . | ||
# 提交修复的代码 | ||
- name: Commit and push fixes | ||
if: success() || failure() | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
git add . | ||
git commit -m "Fix formatting issues" || echo "No changes to commit" | ||
git push | ||
update-hosts: | ||
runs-on: ubuntu-latest | ||
|
||
# 添加并发限制,避免同时运行多个工作流 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
@@ -28,19 +62,19 @@ jobs: | |
fetch-depth: 1 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 # 使用最新的 v5 版本 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
cache: 'pip' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pip | ||
sudo pip install -r requirements.txt | ||
- name: Run hosts update script1 | ||
run: | | ||
sudo python setHosts.py | ||
run: | | ||
sudo python3 setHosts_Classic.py | ||
# 提交并推送更新(仅在文件变更时) | ||
- name: Commit and push changes | ||
|
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
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
Oops, something went wrong.