Skip to content

ci: add GitHub Action to mirror main to Codeberg#7

Merged
fldlqu merged 1 commit into
mainfrom
ci/mirror-to-codeberg
Jul 24, 2026
Merged

ci: add GitHub Action to mirror main to Codeberg#7
fldlqu merged 1 commit into
mainfrom
ci/mirror-to-codeberg

Conversation

@fldlqu

@fldlqu fldlqu commented Jul 24, 2026

Copy link
Copy Markdown
Member

本 PR 新增 GitHub Actions,在 main 分支推送时自动将代码镜像强制推送至 Codeberg;同时将项目版本号从 125 更新为 126。

Requires CODEPUSH_TOKEN secret in GitHub repo settings.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying owproject with  Cloudflare Pages  Cloudflare Pages

Latest commit: b7db0f4
Status: ✅  Deploy successful!
Preview URL: https://eb7f9bfb.owproject.pages.dev
Branch Preview URL: https://ci-mirror-to-codeberg.owproject.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

新增主分支到 Codeberg 的自动镜像工作流,并将构建版本号从 125 更新为 126。

Changes

Codeberg 镜像同步

Layer / File(s) Summary
Codeberg 镜像工作流
.github/workflows/mirror-to-codeberg.yml
新增在 main 分支推送时运行的工作流,检出完整仓库后使用令牌配置 Codeberg remote,并强制推送 main

构建版本更新

Layer / File(s) Summary
构建版本号
js/version.js
将导出的 VERSION 常量从 125 更新为 126

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: octobersama

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要变更:新增 GitHub Actions 工作流,将 main 镜像到 Codeberg。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@Octobersama

Copy link
Copy Markdown
Member

真的有必要吗 维护俩仓库不是更费劲 到时候哪个是mirror哪个是开发仓库

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4698403 and b7db0f4.

📒 Files selected for processing (2)
  • .github/workflows/mirror-to-codeberg.yml
  • js/version.js

Comment on lines +11 to +17
- 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 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" || true

Repository: OTTOWiki/OWProject

Length of output: 240


避免把凭据留在 runner 的 git 配置里。
.github/workflows/mirror-to-codeberg.yml 这里会把 GITHUB_TOKENCODEBERG_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

@Octobersama

Copy link
Copy Markdown
Member

@fldlqu 别老惦记着你那Codeberg了

@fldlqu
fldlqu merged commit aeb6083 into main Jul 24, 2026
4 checks passed
@fldlqu
fldlqu deleted the ci/mirror-to-codeberg branch July 24, 2026 01:34
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