ci: add GitHub Action to mirror main to Codeberg#7
Conversation
Requires CODEPUSH_TOKEN secret in GitHub repo settings.
Deploying owproject with
|
| Latest commit: |
b7db0f4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://eb7f9bfb.owproject.pages.dev |
| Branch Preview URL: | https://ci-mirror-to-codeberg.owproject.pages.dev |
📝 WalkthroughWalkthrough新增主分支到 Codeberg 的自动镜像工作流,并将构建版本号从 125 更新为 126。 ChangesCodeberg 镜像同步
构建版本更新
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
|
真的有必要吗 维护俩仓库不是更费劲 到时候哪个是mirror哪个是开发仓库 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/mirror-to-codeberg.yml:
- Around line 11-17: Update the checkout step in the mirror workflow to set
persist-credentials to false, then revise the Push to Codeberg step around the
codeberg remote so credentials are supplied through a temporary credential
helper or remote only for the push. After pushing, remove the temporary helper
and codeberg remote so neither token remains in the runner’s Git configuration.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: faa496de-32e0-4eeb-a74b-b316b8fecf89
📒 Files selected for processing (2)
.github/workflows/mirror-to-codeberg.ymljs/version.js
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Push to Codeberg | ||
| run: | | ||
| git remote add codeberg https://flandre_scarlet:${{ secrets.CODEBERG_TOKEN }}@codeberg.org/OTTOWiki/OWProject.git |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file=".github/workflows/mirror-to-codeberg.yml"
echo "== file lines =="
cat -n "$file"Repository: OTTOWiki/OWProject
Length of output: 693
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file=".github/workflows/mirror-to-codeberg.yml"
echo "== outline (if supported) =="
ast-grep outline "$file" || trueRepository: OTTOWiki/OWProject
Length of output: 240
避免把凭据留在 runner 的 git 配置里。
.github/workflows/mirror-to-codeberg.yml 这里会把 GITHUB_TOKEN 和 CODEBERG_TOKEN 都写进本地 git 配置;改成 persist-credentials: false,并用临时 credential helper/remote,推送后清理掉远程配置。
🧰 Tools
🪛 zizmor (1.26.1)
[warning] 11-13: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/mirror-to-codeberg.yml around lines 11 - 17, Update the
checkout step in the mirror workflow to set persist-credentials to false, then
revise the Push to Codeberg step around the codeberg remote so credentials are
supplied through a temporary credential helper or remote only for the push.
After pushing, remove the temporary helper and codeberg remote so neither token
remains in the runner’s Git configuration.
Source: Linters/SAST tools
|
@fldlqu 别老惦记着你那Codeberg了 |
本 PR 新增 GitHub Actions,在
main分支推送时自动将代码镜像强制推送至 Codeberg;同时将项目版本号从 125 更新为 126。