Skip to content
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

test python #5

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .github/workflows/pr-changed-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,30 @@ jobs:
id: changed-files
uses: tj-actions/changed-files@v35

- name: Process changed files with Python
run: |
python << EOF
import os
import json

# 从环境变量读取更改的文件列表
changed_files = os.environ['CHANGED_FILES']
# 将字符串转换为列表
changed_files_list = json.loads(changed_files)
print("Changed files:")
for file in changed_files_list:
print(f"- {file}")

# 计算更改的文件数量
file_count = len(changed_files_list)

# 将文件数量设置为输出变量
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f"file_count={file_count}", file=fh)
EOF
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}

- name: Create file list
id: file-list
run: |
Expand All @@ -37,4 +61,4 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
body: `修改的文件列表:\n\n${{ steps.file-list.outputs.file_list }}`
})
})
Loading