Skip to content

test cd#170

Merged
martinliu merged 1 commit intomasterfrom
verify-gh-actions
Aug 22, 2025
Merged

test cd#170
martinliu merged 1 commit intomasterfrom
verify-gh-actions

Conversation

@martinliu
Copy link
Copy Markdown
Owner

No description provided.

Comment on lines +110 to +130
runs-on: ubuntu-latest
# 当用户未确认时执行,提供警告信息
if: ${{ inputs.confirm_production != true }}

steps:
# Step 1 - CloudFlare发布到 Pages CDN 的生产环境,CloudFlare 将 gh-pages 作为部署目标
- name: Triger CloudFlare hook
run: curl -X POST "https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/b1b6b15d-b582-4304-bb0a-238b32bc3eb7" No newline at end of file
- name: ⚠️ 部署确认失败
run: |
echo "⚠️ 部署已取消 - 未确认生产环境部署"
echo ""
echo "📋 提交的信息:"
echo " 📝 部署原因: ${{ inputs.deployment_reason }}"
echo " ✅ 确认部署: ${{ inputs.confirm_production }}"
echo " 👤 操作人员: ${{ github.actor }}"
echo ""
echo "🔒 安全提示:"
echo " 为了安全起见,必须明确确认才能部署到生产环境"
echo " 请重新运行工作流并勾选 '确认部署到生产环境' 选项"
echo ""
echo "## ⚠️ 部署确认失败" >> $GITHUB_STEP_SUMMARY
echo "部署已取消,因为未确认生产环境部署。" >> $GITHUB_STEP_SUMMARY

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 9 months ago

To fix the issue, an explicit permissions block should be added at the beginning of the workflow file (at root level), granting only the minimal permissions the workflow jobs require. Since the jobs in this workflow only echo information, send notifications, and call external endpoints, they do not seem to require any write GitHub permissions (e.g., contents: write, pages: write, or pull-requests: write). The minimal safe set is contents: read, which is almost always needed (and is the lowest reasonable setting).

  • The permissions block should be added after the name: and before on:.
  • The rest of the workflow does not need to be changed, as no steps interact with the repository in a way that requires further permissions.

Suggested changeset 1
.github/workflows/page-deploy.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/page-deploy.yml b/.github/workflows/page-deploy.yml
--- a/.github/workflows/page-deploy.yml
+++ b/.github/workflows/page-deploy.yml
@@ -1,5 +1,7 @@
 # 触发 CloudFlare 生产环境部署 
 name: CD - Push to PRD*CloudFlare
+permissions:
+  contents: read
 
 # 完全手动触发,不依赖其他工作流
 on:
EOF
@@ -1,5 +1,7 @@
# 触发 CloudFlare 生产环境部署
name: CD - Push to PRD*CloudFlare
permissions:
contents: read

# 完全手动触发,不依赖其他工作流
on:
Copilot is powered by AI and may make mistakes. Always verify output.
@martinliu martinliu merged commit a143c62 into master Aug 22, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants