Skip to content

Commit 5b09597

Browse files
authored
Merge pull request #1 from wwcrdrvf6u/main
add workflow
2 parents 2bbb8fa + b1e017f commit 5b09597

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/blank.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Generate img.txt
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch: # 手动触发
8+
9+
jobs:
10+
generate-img-txt:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: '3.x'
21+
22+
- name: Find all image files in 'images' folder and generate img.txt
23+
run: |
24+
# 检查 images 文件夹是否存在
25+
if [ -d "./images" ]; then
26+
# 查找 ./images 目录下的所有常见图片格式
27+
# 格式包括: png, webp, jpg, jpeg, gif, bmp, svg, tiff, tif, ico
28+
find ./images -type f \( \
29+
-name "*.png" -o \
30+
-name "*.webp" -o \
31+
-name "*.jpg" -o \
32+
-name "*.jpeg" -o \
33+
-name "*.gif" -o \
34+
-name "*.bmp" -o \
35+
-name "*.svg" -o \
36+
-name "*.tiff" -o \
37+
-name "*.tif" -o \
38+
-name "*.ico" \
39+
\) | sed 's|^\./||' > img.txt
40+
41+
echo "Found $(wc -l < img.txt) image files."
42+
else
43+
echo "Warning: 'images' directory not found. Creating empty img.txt."
44+
touch img.txt
45+
fi
46+
- name: Commit and push changes
47+
run: |
48+
git config --global user.name 'github-actions[bot]'
49+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
50+
git add img.txt
51+
git commit -m 'Auto-generate img.txt with all image paths'
52+
git push
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

img.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
images/我不行了.jpg
2+
images/无奈.jpg

0 commit comments

Comments
 (0)