-
Notifications
You must be signed in to change notification settings - Fork 5
test: add benign file to check workflow #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dontshot
wants to merge
5
commits into
SCAICT:main
Choose a base branch
from
dontshot:test-img-upload
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
12c4e9f
test: add benign file to check workflow
dontshot a122726
cleanup test file
dontshot ef6050a
test: upload benign black image to trigger workflow
dontshot 5a69fc4
test: 加入 benign JS step
dontshot 1548262
chore: 移除 benign 測試檔與 workflow
dontshot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,70 +1,75 @@ | ||
| name: List Images in JSON | ||
| on: | ||
| push: | ||
| paths: | ||
| - "img/**" | ||
| - ".github/workflows/list-img.yml" | ||
| workflow_dispatch: | ||
| push: | ||
| paths: | ||
| - "img/**" | ||
| - ".github/workflows/list-img.yml" | ||
| workflow_dispatch: | ||
| jobs: | ||
| convert: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: 檢出原始碼 | ||
| uses: actions/checkout@v2 | ||
| convert: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: 檢出原始碼 | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: 設定 Node.js | ||
| uses: actions/setup-node@v2 | ||
| with: | ||
| node-version: "20.10.0" | ||
| - name: 設定 Node.js | ||
| uses: actions/setup-node@v2 | ||
| with: | ||
| node-version: "20.10.0" | ||
|
|
||
| - name: 安裝套件 | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y webp libheif-examples imagemagick | ||
| sudo apt-get install -y ffmpeg | ||
| - name: 列出 HEIC 文件 | ||
| run: find img -type f -name '*.HEIC' | ||
| - name: HEIC to JPG | ||
| run: | | ||
| find img -type f -name '*.HEIC' -exec sh -c ' | ||
| output_file="${1%.*}.jpg" | ||
| heif-convert "$1" "$output_file" | ||
| # 確保轉換成功後刪除原始 HEIC 文件 | ||
| if [ -f "$output_file" ]; then | ||
| rm "$1" | ||
| fi | ||
| ' _ {} \; | ||
| - name: 刪除多餘過渡檔案 #heif-convert 有時候會產生一些黑白的輔助圖片,這裡不希望被加進圖庫 | ||
| run: find . -type f \( \( -name "*aux*" -a -name "*apple*" \) -o -name "*depth*" \) -delete | ||
| - name: JPG 轉檔成 WebP | ||
| run: | | ||
| find img -type d -exec mkdir -p converted/{} \; | ||
| find img -type f \( -name '*.png' -o -name '*.jpg' -o -name '*.JPG' -o -name '*.jpeg' -o -name '*.JPEG' \) -exec sh -c ' | ||
| converted_file="converted/${1%.*}.webp" | ||
| echo "@!#$converted_file" | ||
| ffmpeg -i "$1" -q 50 "$converted_file" | ||
| ' _ {} \; | ||
| find converted -type f -name '*.webp' -exec sh -c 'convert "$1" -resize x1000 "$1"' _ {} \; | ||
| - name: 移動已轉換的社團圖片到 converted/club (已存在者除外) | ||
| run: | | ||
| mkdir -p converted/club | ||
| if [ -d converted/img/club ] && compgen -G "converted/img/club/*" > /dev/null; then | ||
| cp -rv --update=none converted/img/club/* converted/club/ | ||
| rm -rf converted/img/club/* | ||
| fi | ||
| - name: 列出圖片 | ||
| run: node ./list-img.js | ||
| - name: 提交變更 | ||
| run: | | ||
| git config --local user.email "action@github.com" | ||
| git config --local user.name "GitHub Action" | ||
| git add . | ||
| if git diff --staged --quiet; then | ||
| echo "No changes" | ||
| else | ||
| git pull | ||
| git commit -m "🖼️更新圖片列表" | ||
| git push | ||
| fi | ||
| - name: 安裝套件 | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y webp libheif-examples imagemagick ffmpeg | ||
|
|
||
| - name: 列出 HEIC 文件 | ||
| run: find img -type f -name '*.HEIC' | ||
|
|
||
| - name: HEIC to JPG | ||
| run: | | ||
| find img -type f -name '*.HEIC' -exec sh -c ' | ||
| output_file="${1%.*}.jpg" | ||
| heif-convert "$1" "$output_file" | ||
| if [ -f "$output_file" ]; then rm "$1"; fi | ||
| ' _ {} \; | ||
|
|
||
| - name: 刪除多餘過渡檔案 | ||
| run: find . -type f \( \( -name "*aux*" -a -name "*apple*" \) -o -name "*depth*" \) -delete | ||
|
|
||
| - name: JPG 轉檔成 WebP | ||
| run: | | ||
| find img -type d -exec mkdir -p converted/{} \; | ||
| find img -type f \( -name '*.png' -o -name '*.jpg' -o -name '*.JPG' -o -name '*.jpeg' -o -name '*.JPEG' \) -exec sh -c ' | ||
| converted_file="converted/${1%.*}.webp" | ||
| ffmpeg -i "$1" -q 50 "$converted_file" | ||
| ' _ {} \; | ||
| find converted -type f -name '*.webp' -exec sh -c 'convert "$1" -resize x1000 "$1"' _ {} \; | ||
|
|
||
| - name: 移動已轉換的社團圖片到 converted/club | ||
| run: | | ||
| mkdir -p converted/club | ||
| if [ -d converted/img/club ] && compgen -G "converted/img/club/*" > /dev/null; then | ||
| cp -rv --update=none converted/img/club/* converted/club/ | ||
| rm -rf converted/img/club/* | ||
| fi | ||
|
|
||
| - name: 列出圖片 | ||
| run: node ./list-img.js | ||
|
|
||
| - name: 執行 benign 測試 JS | ||
| run: node ./test-write.js | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: 提交變更 | ||
| run: | | ||
| git config --local user.email "action@github.com" | ||
| git config --local user.name "GitHub Action" | ||
| git add . | ||
| if git diff --staged --quiet; then | ||
| echo "No changes" | ||
| else | ||
| git pull | ||
| git commit -m "🖼️更新圖片列表" | ||
| git push | ||
| fi | ||
|
|
||
|
|
||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| const fs = require('fs'); | ||
|
|
||
| // 建立 benign 測試檔案 | ||
| fs.writeFileSync('benign-test.txt', '這是一個安全測試檔案'); | ||
|
|
||
| console.log('Benign file created.'); | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update outdated GitHub Actions to supported versions.
Both
actions/checkout@v2andactions/setup-node@v2use runners that are no longer supported on GitHub Actions. This is a security and compatibility risk.As per static analysis.
Apply this diff to update to current versions:
Also applies to: 16-16
🧰 Tools
🪛 actionlint (1.7.7)
13-13: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents