commit cf17c9ea42623bef1c892ea6b601fd3f0b5127a1 Author: xhgit Date: Sat Nov 7 17:17:27 2026 +0800 Initial commit: 小南娘 - 面向可爱的蓝孩子的 git 学习实践项目 仿 Dress 的照片投稿仓库, 适配自建 Gitea 平台 git.xhmcl.com: - README / GUIDE (PR 教程) / CONTRIBUTING / Q&A / EXIF / PARTIAL_CLONE (中英双语) - A-Z + # 首字母目录结构 - .gitea: PR 模板、维护者名单、7 个纯 bash + API 的 Actions 工作流 (可选功能) Co-Authored-By: Claude Code diff --git a/#/.gitkeep b/#/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..284475e --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.sig linguist-vendored=true diff --git a/.gitea/MAINTAINERS.yml b/.gitea/MAINTAINERS.yml new file mode 100644 index 0000000..f7a5ce7 --- /dev/null +++ b/.gitea/MAINTAINERS.yml @@ -0,0 +1,9 @@ +# 维护者名单 / Maintainers +# +# 想要在 PR 多次未通过内容检查时收到通知的维护者, 把自己加进这个列表即可. +# 不想收通知的可以不添加 (仓库订阅仍会收到普通提醒). +# Add yourself if you want to be notified when a PR keeps failing the content check. +# +# 此文件由 .gitea/workflows/check_pr_content.yml 读取 (需平台启用 Gitea Actions). +maintainers: + - xhgit # ← 请替换为实际的维护者用户名, 每行一个 diff --git a/.gitea/pull_request_template.md b/.gitea/pull_request_template.md new file mode 100644 index 0000000..6fa386d --- /dev/null +++ b/.gitea/pull_request_template.md @@ -0,0 +1,42 @@ + + + +
+第一次提交?点我查看新手说明 / First time? Click for guide + +请先阅读 [新手指南](https://git.xhmcl.com/xhgit/dress-pr/src/branch/main/GUIDE.md)。 +也可参考 [已合并的 PR](https://git.xhmcl.com/xhgit/dress-pr/pulls?state=closed)。 + +Please read the [Beginner Guide](https://git.xhmcl.com/xhgit/dress-pr/src/branch/main/GUIDE.md). +See [merged PRs](https://git.xhmcl.com/xhgit/dress-pr/pulls?state=closed) for examples. + +
+ +**PR 类型**:图片提交 / Photo submission + +**简单描述**(可选): + + +### 自查清单 / Checklist + +请自行确认并勾选。Please check each item yourself. + +- [ ] 图片已压缩至 1 MiB 以内 / Images are under 1 MiB(见 [CONTRIBUTING.md](https://git.xhmcl.com/xhgit/dress-pr/src/branch/main/CONTRIBUTING.md)) +- [ ] 已移除高敏感 EXIF(GPS/地址/联系方式)/ High-sensitivity EXIF removed([字段说明](https://git.xhmcl.com/xhgit/dress-pr/src/branch/main/EXIF.md) · [清理方法](https://git.xhmcl.com/xhgit/dress-pr/src/branch/main/CONTRIBUTING.md)) +- [ ] 文件在对应首字母目录下 `A-Z/#/昵称/` / Folder under matching `A-Z/#`(见 [GUIDE.md](https://git.xhmcl.com/xhgit/dress-pr/src/branch/main/GUIDE.md);无需强制账号 ID) + - 正确: `M/moe/photo.jpg` 或 `#/233/photo.jpg` + - 错误: `moe/photo.jpg`(缺少首字母目录) +- [ ] 图片为本人原创,未盗用他人作品 / Images are original and not stolen from others +- [ ] 已阅读 [新手指南](GUIDE.md),并按其中流程提交 / Have read and followed the [Beginner Guide](GUIDE.md) + +--- + +**本次不是交照片?** / Not a photo PR? + +请把最上方的 `pr-type` 改为对应类型,并替换上方清单为对应自查项(同样使用 `- [ ]` 格式并全部勾选): + +- `ci_wf`:CI / 工作流修改 → 自查:改动均在 `.gitea/` 下;已在 fork 上确认 workflow 行为符合预期 +- `docs`:文档修改 → 自查:本次以文档/说明为主,不含照片;链接与路径已核对 +- `others`:其他 → 自查:已说明为何不属于「图片提交 / CI / 文档」 + +> 平台说明:Gitea 暂不支持像 GitHub 那样的多模板切换,本仓库统一使用这一个模板,由顶部的 `pr-type` 标记区分 PR 类型(自动化检查会读取它)。 diff --git a/.gitea/workflows/auto_fix.yml b/.gitea/workflows/auto_fix.yml new file mode 100644 index 0000000..c6727e6 --- /dev/null +++ b/.gitea/workflows/auto_fix.yml @@ -0,0 +1,287 @@ +# Auto-fix Image Files +# +# PR 评论 /auto-fix 触发 (仅维护者或 PR 作者). (纯 shell + 平台 API) +# 对变更图片: 去除全部 EXIF, 循环压缩至 <= 1 MiB, 再 push 回 PR 分支. +# push 后由 check_file_size / check_exif 的 pull_request_target 自然重跑. +# +# 前置条件: +# - 平台启用 Gitea Actions 并注册 ubuntu runner (需要 apt 安装工具) +# - 仓库「设置 → Actions → Secrets」中配置: +# BOT_USER 有 Fork 仓库写权限的账号名 +# BOT_TOKEN 该账号的访问令牌 (本平台无 SSH, 仅 HTTP push) +# 未配置时工作流会评论说明并退出, 不进行修复. +name: Auto-fix Image Files + +on: + issue_comment: + types: [created] + +jobs: + auto-fix: + name: Auto-fix Images (EXIF & Size) + if: > + github.event.issue.pull_request && + startsWith(github.event.comment.body, '/auto-fix') + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + sudo apt-get install -y --no-install-recommends libimage-exiftool-perl imagemagick jpegoptim optipng pngquant jq \ + || (sudo apt-get update && sudo apt-get install -y --no-install-recommends libimage-exiftool-perl imagemagick jpegoptim optipng pngquant jq) + + - name: Check permission (PR author or write access) + id: perm + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ gitea.server_url || 'https://git.xhmcl.com' }}/api/v1 + REPO: ${{ github.repository }} + PR_NUM: ${{ github.event.issue.number }} + COMMENT_USER: ${{ github.event.comment.user.login }} + run: | + set -euo pipefail + OWNER="${REPO%%/*}" + NAME="${REPO#*/}" + api() { curl -fsS -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "$@"; } + + PR_AUTHOR=$(api "$API/repos/$OWNER/$NAME/pulls/$PR_NUM" | jq -r '.user.login // ""') + if [ "$COMMENT_USER" = "$PR_AUTHOR" ] && [ -n "$PR_AUTHOR" ]; then + echo "Commenter is the PR author, allowed." + exit 0 + fi + + perm=$(api "$API/repos/$OWNER/$NAME/collaborators/$COMMENT_USER/permission" 2>/dev/null | jq -r '.permission // "none"' || echo none) + case "$perm" in + admin|write|owner) echo "Commenter has $perm permission, allowed." ;; + *) echo "Commenter $COMMENT_USER has no write permission."; exit 1 ;; + esac + + - name: Acknowledge command and start processing + id: init + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ gitea.server_url || 'https://git.xhmcl.com' }}/api/v1 + REPO: ${{ github.repository }} + PR_NUM: ${{ github.event.issue.number }} + COMMENT_ID: ${{ github.event.comment.id }} + run: | + set -euo pipefail + OWNER="${REPO%%/*}" + NAME="${REPO#*/}" + api() { curl -fsS -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "$@"; } + + # rocket 反应 + api -X POST -d '{"content":"rocket"}' "$API/repos/$OWNER/$NAME/issues/comments/$COMMENT_ID/reactions" || true + + # 处理中评论 + ACK=$(api -X POST -d '{"body":"自动修复工作中... (Auto-fix initiated! Processing images...)"}' \ + "$API/repos/$OWNER/$NAME/issues/$PR_NUM/comments") + ACK_ID=$(echo "$ACK" | jq -r '.id') + echo "ack_comment_id=$ACK_ID" >> "$GITHUB_OUTPUT" + + - name: Fetch PR branch and process images + id: process + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ gitea.server_url || 'https://git.xhmcl.com' }}/api/v1 + SERVER: ${{ gitea.server_url || 'https://git.xhmcl.com' }} + REPO: ${{ github.repository }} + PR_NUM: ${{ github.event.issue.number }} + HEAD_OWNER: ${{ github.event.pull_request.head.repo.owner.login }} + HEAD_REPO: ${{ github.event.pull_request.head.repo.name }} + HEAD_REF: ${{ github.event.pull_request.head.ref }} + BOT_USER: ${{ secrets.BOT_USER }} + BOT_TOKEN: ${{ secrets.BOT_TOKEN }} + run: | + set -euo pipefail + OWNER="${REPO%%/*}" + NAME="${REPO#*/}" + api() { curl -fsS -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "$@"; } + + HOST=$(printf '%s' "$SERVER" | sed -E 's#^https?://##') + IMAGE_EXT_RE='\.(jpe?g|jfif|png|webp|tiff?|hei[cf]|avif|gif|bmp)$' + MAX_SIZE=$((1024 * 1024)) + + fail_msg() { + local msg="$1" + BODY_JSON=$(jq -n --arg b "$msg" '{"body": $b}') + api -X POST -d "$BODY_JSON" "$API/repos/$OWNER/$NAME/issues/$PR_NUM/comments" + exit 1 + } + + if [ -z "$BOT_USER" ] || [ -z "$BOT_TOKEN" ]; then + fail_msg "**自动修复未执行 (Auto-fix not run).** + + 未配置仓库 Secrets \`BOT_USER\` / \`BOT_TOKEN\` (需要一个有 Fork 仓库写权限的账号令牌, 本平台仅支持 HTTP push). + 请维护者在 设置 → Actions → Secrets 中配置, 或在本地自行处理后重新 push. + (Missing repo secrets BOT_USER / BOT_TOKEN; a bot account with write access to the fork is required. Please configure them, or fix the images manually and push again.)" + fi + + WORK="$RUNNER_TEMP/dress-pr-work" + mkdir -p "$WORK" + CLONE_URL="https://${BOT_USER}:${BOT_TOKEN}@${HOST}/${HEAD_OWNER}/${HEAD_REPO}.git" + + echo "Cloning head repo $HEAD_OWNER/$HEAD_REPO branch $HEAD_REF ..." + git clone --depth 1 --branch "$HEAD_REF" "$CLONE_URL" "$WORK/repo" || \ + fail_msg "**自动修复失败 (Auto-fix failed).** 无法克隆 PR 分支, 请检查 \`BOT_TOKEN\` 是否有效且有该 Fork 仓库的写权限. (Cannot clone the PR branch; please check that BOT_TOKEN is valid and has write access to the fork.)" + cd "$WORK/repo" + git config user.name "dress-bot" + git config user.email "dress-bot@users.noreply.git.xhmcl.com" + + # 变更图片列表 (与 size/exif 检查同一份 diff) + FILES_TMP=$(mktemp) + page=1 + while :; do + resp=$(api "$API/repos/$OWNER/$NAME/pulls/$PR_NUM/files?limit=50&page=$page") + n=$(echo "$resp" | jq 'if type=="array" then length else 0 end') + echo "$resp" | jq -r '.[] | "\(.status // "unknown")\t\(.filename // "")"' >> "$FILES_TMP" || true + [ "$n" -lt 50 ] && break + page=$((page + 1)) + done + awk -F'\t' '$1 ~ /^(added|modified|renamed|copied)$/ {print $2}' "$FILES_TMP" \ + | grep -iE "$IMAGE_EXT_RE" > "$WORK/changed_images.txt" || true + + if [ ! -s "$WORK/changed_images.txt" ]; then + fail_msg "**自动修复完成 (Auto-fix: nothing to do).** 该 PR 没有图片变更. (No changed images in this PR.)" + fi + echo "Changed images to process:"; cat "$WORK/changed_images.txt" + + BASE_SHA=$(git rev-parse HEAD) + + # Phase 1: 清除全部 EXIF + exif_changed=0 + while IFS= read -r file; do + [ -z "$file" ] && continue + if [ -f "$file" ]; then + count=$(exiftool -EXIF:all -S -q -- "$file" 2>/dev/null | wc -l) + count=${count// /} + if [ "${count:-0}" -gt 0 ]; then + echo "Removing EXIF: $file" + exiftool -all= -overwrite_original "$file" + git add -- "$file" + exif_changed=1 + fi + fi + done < "$WORK/changed_images.txt" + + if [ "$exif_changed" -eq 1 ]; then + git commit -m "chore: auto-remove EXIF data from images" || true + fi + + # Phase 2: 压缩超限图片 + failed_files=() + size_changed=0 + file_size() { stat -c%s "$1" 2>/dev/null || echo 0; } + + while IFS= read -r file; do + [ -z "$file" ] && continue + [ -f "$file" ] || continue + size=$(file_size "$file") + [ "$size" -le "$MAX_SIZE" ] && continue + + echo "Compressing: $file ($size bytes)" + ext_lower=$(echo "${file##*.}" | tr '[:upper:]' '[:lower:]') + attempt=0 + + while [ "$(file_size "$file")" -gt "$MAX_SIZE" ] && [ "$attempt" -lt 20 ]; do + attempt=$((attempt + 1)) + echo " attempt $attempt / 20" + case "$ext_lower" in + jpg|jpeg|jfif) + if [ "$attempt" -eq 1 ]; then + jpegoptim --size=990k "$file" || true + elif [ "$attempt" -le 8 ]; then + q=$((85 - attempt * 10)); [ "$q" -lt 25 ] && q=25 + mogrify -quality "$q" "$file" + else + mogrify -resize 90% -quality 40 "$file" + fi + ;; + png) + if [ "$attempt" -le 5 ]; then + pngquant --quality=40-70 --ext .png --force "$file" || optipng -o2 "$file" || true + else + mogrify -resize 90% "$file" + fi + ;; + *) + if [ "$attempt" -le 5 ]; then + q=$((80 - attempt * 10)); [ "$q" -lt 25 ] && q=25 + mogrify -quality "$q" "$file" + else + mogrify -resize 90% -quality 40 "$file" + fi + ;; + esac + done + + new_size=$(file_size "$file") + if [ "$new_size" -gt "$MAX_SIZE" ]; then + echo "Failed to compress $file below 1 MiB (current: $new_size bytes)" + failed_files+=("$file") + else + echo "OK: $file -> $new_size bytes" + git add -- "$file" + size_changed=1 + fi + done < "$WORK/changed_images.txt" + + if [ "${#failed_files[@]}" -gt 0 ]; then + # 回滚本地修改, 不 push 半成品 + git reset --hard "$BASE_SHA" + FAILED_LIST=$(printf '%s\n' "${failed_files[@]}" | sed 's/^/- /') + echo "failed_list=$FAILED_LIST" >> "$GITHUB_OUTPUT" + echo "failed=true" >> "$GITHUB_OUTPUT" + exit 2 + fi + + if [ "$size_changed" -eq 1 ]; then + git commit -m "chore: auto-compress oversized images" || true + fi + + # Phase 3: push 回 PR 分支 + git push origin "HEAD:${HEAD_REF}" + echo "pushed=true" >> "$GITHUB_OUTPUT" + + - name: Report Completion + if: always() + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ gitea.server_url || 'https://git.xhmcl.com' }}/api/v1 + SERVER: ${{ gitea.server_url || 'https://git.xhmcl.com' }} + REPO: ${{ github.repository }} + PR_NUM: ${{ github.event.issue.number }} + ACK_ID: ${{ steps.init.outputs.ack_comment_id }} + PROCESS_OUTCOME: ${{ steps.process.outcome }} + FAILED_LIST: ${{ steps.process.outputs.failed_list }} + run: | + set -euo pipefail + OWNER="${REPO%%/*}" + NAME="${REPO#*/}" + api() { curl -fsS -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "$@"; } + + if [ "$PROCESS_OUTCOME" = "failure" ] && [ -n "$FAILED_LIST" ]; then + MSG="**自动修复未完全成功 (Auto-fix failed to compress some files).** + + 经多次压缩仍无法将以下文件压至 1 MiB 以内 (已回滚, 未推送): + (Still over 1 MiB after repeated compression; changes were reverted and not pushed:) + + $FAILED_LIST + + **如何手动修复 (How to fix manually):** + 请在本地缩小分辨率或改用更高压缩率格式后再次提交. + (Please scale down resolution or use a more efficient format, then push again.)" + elif [ "$PROCESS_OUTCOME" = "success" ]; then + MSG="**自动修复成功 (Auto-fix completed successfully)!** + 已去除全部 EXIF (如有) 并压缩超限图片 (如有). push 后将由 size / EXIF 检查自动重跑. + (All EXIF stripped if present; oversized images compressed if needed. size / EXIF checks will re-run after the push.)" + else + MSG="**自动修复失败 (Auto-fix failed).**\n请查看 [Actions Log]($SERVER/$OWNER/$NAME/actions/runs/${GITHUB_RUN_ID:-unknown}) 获取详情。(Please check the Actions Log for details.)" + fi + + if [ -n "$ACK_ID" ] && [ "$ACK_ID" != "0" ]; then + BODY_JSON=$(jq -n --arg b "$MSG" '{"body": $b}') + api -X PATCH -d "$BODY_JSON" "$API/repos/$OWNER/$NAME/issues/comments/$ACK_ID" || true + else + BODY_JSON=$(jq -n --arg b "$MSG" '{"body": $b}') + api -X POST -d "$BODY_JSON" "$API/repos/$OWNER/$NAME/issues/$PR_NUM/comments" || true + fi diff --git a/.gitea/workflows/check_exif.yml b/.gitea/workflows/check_exif.yml new file mode 100644 index 0000000..55d4dd3 --- /dev/null +++ b/.gitea/workflows/check_exif.yml @@ -0,0 +1,146 @@ +# Check Image EXIF Data +# +# 仅在 PR 为图片提交时检查变更图片是否含高敏感 EXIF (GPS / 地址 / 联系方式). +# 普通摄影参数 (光圈, 快门等) 不拦截. (纯 shell + 平台 API) +# +# 要求: +# - 平台启用 Gitea Actions 并注册 ubuntu runner (需要 apt 安装 exiftool) +# - 若 Gitea 版本不支持 pull_request_target, 请改为 pull_request +name: Check Image EXIF Data + +on: + pull_request_target: + types: [opened, synchronize, reopened] + +concurrency: + group: exif-pr-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + check-exif: + runs-on: ubuntu-latest + steps: + - name: Install exiftool and jq + run: | + sudo apt-get install -y --no-install-recommends libimage-exiftool-perl jq \ + || (sudo apt-get update && sudo apt-get install -y --no-install-recommends libimage-exiftool-perl jq) + + - name: Check EXIF in changed images + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ gitea.server_url || 'https://git.xhmcl.com' }}/api/v1 + REPO: ${{ github.repository }} + PR_NUM: ${{ github.event.pull_request.number }} + HEAD_OWNER: ${{ github.event.pull_request.head.repo.owner.login }} + HEAD_REPO: ${{ github.event.pull_request.head.repo.name }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + set -euo pipefail + OWNER="${REPO%%/*}" + NAME="${REPO#*/}" + IMAGE_EXT_RE='\.(jpe?g|jfif|png|webp|tiff?|hei[cf]|avif|gif|bmp)$' + ACTIVE_RE='^(added|modified|renamed|copied)$' + + # GPS / IPTC address / XMP location & contact + HIGH_SENS_ARGS=( + '-GPS:GPSLatitude' '-GPS:GPSLongitude' '-GPS:GPSAltitude' + '-GPS:GPSDateStamp' '-GPS:GPSTimeStamp' + '-GPS:GPSSpeed' '-GPS:GPSTrack' '-GPS:GPSImgDirection' + '-IPTC:City' '-IPTC:Country-PrimaryLocationName' + '-IPTC:Sub-location' '-IPTC:Province-State' + '-XMP-photoshop:City' '-XMP-photoshop:Country' '-XMP-photoshop:State' + '-XMP-iptcCore:CreatorWorkEmail' '-XMP-iptcCore:CreatorWorkTelephone' + '-XMP-iptcCore:CreatorCity' '-XMP-iptcCore:CreatorCountry' + '-XMP-iptcCore:CreatorPostalCode' + ) + + api() { + curl -fsS -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "$@" + } + + PR_BODY=$(api "$API/repos/$OWNER/$NAME/pulls/$PR_NUM" | jq -r '.body // ""') + PR_TYPE=$(printf '%s\n' "$PR_BODY" | grep -oE 'pr-type:[[:space:]]*[A-Za-z_0-9]+' | head -1 | cut -d: -f2 | tr -d '[:space:]') + PR_TYPE=${PR_TYPE:-images} + + if [ "$PR_TYPE" != "images" ]; then + echo "pr-type is \"$PR_TYPE\", skip EXIF check." + exit 0 + fi + + FILES_TMP=$(mktemp) + page=1 + while :; do + resp=$(api "$API/repos/$OWNER/$NAME/pulls/$PR_NUM/files?limit=50&page=$page") + n=$(echo "$resp" | jq 'if type=="array" then length else 0 end') + echo "$resp" | jq -r '.[] | "\(.status // "unknown")\t\(.filename // "")"' >> "$FILES_TMP" || true + [ "$n" -lt 50 ] && break + page=$((page + 1)) + done + + IMAGES=$(awk -F'\t' -v re="$ACTIVE_RE" '$1 ~ re {print $2}' "$FILES_TMP" | grep -iE "$IMAGE_EXT_RE" || true) + if [ -z "$IMAGES" ]; then + echo "No changed images found, skip EXIF check." + exit 0 + fi + echo "Checking $(printf '%s\n' "$IMAGES" | grep -c .) image(s) for high-sensitivity EXIF." + + encode_path() { + printf '%s' "$1" | sed -e 's/%/%25/g' -e 's/#/%23/g' -e 's/?/%3F/g' -e 's/ /%20/g' + } + + TMP_DIR=$(mktemp -d) + EXIF_FILES=() + + while IFS= read -r file; do + [ -z "$file" ] && continue + enc=$(encode_path "$file") + content_json=$(api "$API/repos/$HEAD_OWNER/$HEAD_REPO/contents/$enc?ref=$HEAD_SHA" 2>/dev/null || true) + b64=$(echo "$content_json" | jq -r 'if type=="object" and .content then .content else empty end' 2>/dev/null || true) + if [ -z "$b64" ]; then + echo "Warning: cannot fetch $file, skip." + continue + fi + + tmp_file="$TMP_DIR/$(printf '%s' "$file" | tr '/\\' '__')" + printf '%s' "$b64" | base64 -d > "$tmp_file" 2>/dev/null || { echo "Warning: decode failed $file, skip."; continue; } + + # Drop empty/undef/all-zero placeholders (e.g. GPS IFD with no coords). + count=$(exiftool "${HIGH_SENS_ARGS[@]}" -S -q -- "$tmp_file" 2>/dev/null \ + | grep -Ev ': *(undef|00:00:00)?$' | wc -l) + count=${count// /} + + if [ "${count:-0}" -gt 0 ]; then + EXIF_FILES+=("$file") + echo "Sensitive EXIF found: $file ($count tags)" + fi + rm -f "$tmp_file" + done <<< "$IMAGES" + + rm -rf "$TMP_DIR" + + if [ "${#EXIF_FILES[@]}" -gt 0 ]; then + MSG="我们检测到以下文件包含**高敏感 EXIF 信息**(如 GPS 坐标, 地址或联系方式), 请移除后再次提交: + We detected **high-sensitivity EXIF data** (e.g. GPS coordinates, address, or contact fields) in the following files. Please remove them and resubmit: + + $(printf '%s\n' "${EXIF_FILES[@]}" | sed 's/^/- /') + + **仅高敏感字段 (GPS / 地址 / 联系方式) 需要移除, 普通摄影参数 (光圈, 快门等) 无需处理.** + **Only high-sensitivity fields (GPS / address / contact info) need to be removed. Regular photography parameters (aperture, shutter speed, etc.) are fine to keep.** + + [EXIF 说明 / EXIF Guide](https://git.xhmcl.com/$OWNER/$NAME/src/branch/main/EXIF.md) · [CONTRIBUTING.md](https://git.xhmcl.com/$OWNER/$NAME/src/branch/main/CONTRIBUTING.md) + --- + + 温馨提示: 您可以直接使用 \`/auto-fix\` 命令来自动修复这些文件. + Warm reminder: You can use the \`/auto-fix\` command to automatically fix these files. + + 该命令会将图片压缩到 1 MiB 内, 并且去除**所有的 EXIF**信息, 若您不希望文件被改动, 请自行处理后重新提交 PR + This command will compress images to under 1 MiB and strip all EXIF metadata. + If you do not want your files modified, please fix them yourself and push again." + + BODY_JSON=$(jq -n --arg b "$MSG" '{"body": $b}') + api -X POST -d "$BODY_JSON" "$API/repos/$OWNER/$NAME/issues/$PR_NUM/comments" \ + || echo "Warning: cannot comment (check bot account permission)." + echo "High-sensitivity EXIF data detected." + exit 1 + fi + echo "No high-sensitivity EXIF data found." diff --git a/.gitea/workflows/check_file_size.yml b/.gitea/workflows/check_file_size.yml new file mode 100644 index 0000000..556ec8a --- /dev/null +++ b/.gitea/workflows/check_file_size.yml @@ -0,0 +1,115 @@ +# Check File Size +# +# 仅在 PR 为图片提交时检查变更图片是否均 <= 1 MiB (纯 shell + 平台 API). +# +# 检查 pr-type (PR body 中的 ): +# - images (或缺省无标签) -> 执行检查 +# - ci_wf / docs / others -> 跳过, 不 fail +# 无变更图片时跳过, 不 fail (无图提醒交给 check_pr_content) +# +# 要求: +# - 平台启用 Gitea Actions 并注册 ubuntu runner +# - 若 Gitea 版本不支持 pull_request_target, 请改为 pull_request +name: Check File Size + +on: + pull_request_target: + types: [opened, synchronize, reopened] + +jobs: + check-size: + runs-on: ubuntu-latest + steps: + - name: Install jq + run: | + command -v jq && exit 0 + sudo apt-get install -y --no-install-recommends jq \ + || (sudo apt-get update && sudo apt-get install -y --no-install-recommends jq) + + - name: Check file sizes + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ gitea.server_url || 'https://git.xhmcl.com' }}/api/v1 + REPO: ${{ github.repository }} + PR_NUM: ${{ github.event.pull_request.number }} + HEAD_OWNER: ${{ github.event.pull_request.head.repo.owner.login }} + HEAD_REPO: ${{ github.event.pull_request.head.repo.name }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + set -euo pipefail + OWNER="${REPO%%/*}" + NAME="${REPO#*/}" + MAX_SIZE=$((1024 * 1024)) # 1 MiB + IMAGE_EXT_RE='\.(jpe?g|jfif|png|webp|tiff?|hei[cf]|avif|gif|bmp)$' + ACTIVE_RE='^(added|modified|renamed|copied)$' + + api() { + curl -fsS -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "$@" + } + + PR_BODY=$(api "$API/repos/$OWNER/$NAME/pulls/$PR_NUM" | jq -r '.body // ""') + PR_TYPE=$(printf '%s\n' "$PR_BODY" | grep -oE 'pr-type:[[:space:]]*[A-Za-z_0-9]+' | head -1 | cut -d: -f2 | tr -d '[:space:]') + PR_TYPE=${PR_TYPE:-images} + + if [ "$PR_TYPE" != "images" ]; then + echo "pr-type is \"$PR_TYPE\", skip file size check." + exit 0 + fi + + FILES_TMP=$(mktemp) + page=1 + while :; do + resp=$(api "$API/repos/$OWNER/$NAME/pulls/$PR_NUM/files?limit=50&page=$page") + n=$(echo "$resp" | jq 'if type=="array" then length else 0 end') + echo "$resp" | jq -r '.[] | "\(.status // "unknown")\t\(.filename // "")"' >> "$FILES_TMP" || true + [ "$n" -lt 50 ] && break + page=$((page + 1)) + done + + IMAGES=$(awk -F'\t' -v re="$ACTIVE_RE" '$1 ~ re {print $2}' "$FILES_TMP" | grep -iE "$IMAGE_EXT_RE" || true) + if [ -z "$IMAGES" ]; then + echo "No changed images found, skip file size check." + exit 0 + fi + + encode_path() { + # '#' 必须转义, 否则会被当作 URL fragment + printf '%s' "$1" | sed -e 's/%/%25/g' -e 's/#/%23/g' -e 's/?/%3F/g' -e 's/ /%20/g' + } + + OVERSIZED=() + while IFS= read -r file; do + [ -z "$file" ] && continue + enc=$(encode_path "$file") + content_json=$(api "$API/repos/$HEAD_OWNER/$HEAD_REPO/contents/$enc?ref=$HEAD_SHA" 2>/dev/null || true) + size=$(echo "$content_json" | jq -r 'if type=="object" and .size then .size else empty end' 2>/dev/null || true) + if [ -z "$size" ]; then + echo "Warning: cannot read $file (maybe a directory or deleted), skip." + continue + fi + if [ "$size" -gt "$MAX_SIZE" ]; then + OVERSIZED+=("- $file ($size bytes)") + fi + done <<< "$IMAGES" + + if [ "${#OVERSIZED[@]}" -gt 0 ]; then + MSG="我们注意到以下文件的大小超过了 1 MiB, 请在压缩后再次提交 Pull Request: + We have noted that the following files exceed 1 MiB in size. Please resubmit your pull request after compressing them: + + $(printf '%s\n' "${OVERSIZED[@]}") + + --- + + 温馨提示: 您可以直接使用 \`/auto-fix\` 命令来自动修复这些文件。 + Warm reminder: You can use the \`/auto-fix\` command to automatically fix these files. + + 该命令会将图片压缩到 1 MiB 内, 并且去除**所有的 EXIF**信息, 若您不希望文件被改动, 请自行处理后重新提交 PR + This command will compress images to under 1 MiB and strip all EXIF metadata. + If you do not want your files modified, please fix them yourself and push again." + + BODY_JSON=$(jq -n --arg b "$MSG" '{"body": $b}') + api -X POST -d "$BODY_JSON" "$API/repos/$OWNER/$NAME/issues/$PR_NUM/comments" + echo "File size check failed." + exit 1 + fi + echo "All changed images are under 1 MiB." diff --git a/.gitea/workflows/check_pr_content.yml b/.gitea/workflows/check_pr_content.yml new file mode 100644 index 0000000..08aa809 --- /dev/null +++ b/.gitea/workflows/check_pr_content.yml @@ -0,0 +1,216 @@ +# Check PR Content +# +# 综合检查 PR 描述与变更内容 (纯 shell + 平台 API, 不依赖第三方 action). +# +# 检查 pr-type (PR body 中的 ): +# - 缺省无标签 -> 当作 images +# - 所有类型 -> 自查清单须存在且全部勾选 +# - images -> 须有图片变更; 目录须符合 A-Z/#/昵称/ +# - ci_wf -> 变更须均在 .gitea/ 下 +# - docs/others -> 仅清单检查 +# +# 任一项不通过: 评论 + fail +# 评论计数: 每条 check 失败评论带 marker +# 计数达到 3 后不再发 check 评论, 改为 @ 维护者 (.gitea/MAINTAINERS.yml) 通知, 带 marker +# 通知只发一次; 之后完全静默 (检查照跑, 不发任何评论) +# +# 要求: +# - 平台启用 Gitea Actions 并注册 ubuntu runner +# - 若 Gitea 版本不支持 pull_request_target, 请改为 pull_request +name: Check PR Content + +on: + pull_request_target: + types: [opened, synchronize, reopened, edited] + +concurrency: + group: pr-content-${{ github.event.pull_request.number }} + cancel-in-progress: false + +jobs: + check-content: + runs-on: ubuntu-latest + steps: + - name: Install jq + run: | + command -v jq && exit 0 + sudo apt-get install -y --no-install-recommends jq \ + || (sudo apt-get update && sudo apt-get install -y --no-install-recommends jq) + + - name: Check PR content + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ gitea.server_url || 'https://git.xhmcl.com' }}/api/v1 + REPO: ${{ github.repository }} + PR_NUM: ${{ github.event.pull_request.number }} + run: | + set -euo pipefail + OWNER="${REPO%%/*}" + NAME="${REPO#*/}" + + api() { + curl -fsS -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "$@" + } + + IMAGE_EXT_RE='\.(jpe?g|jfif|png|webp|tiff?|hei[cf]|avif|gif|bmp)$' + ACTIVE_RE='^(added|modified|renamed|copied)$' + CHECK_COMMENT_MARKER='' + NOTIFY_MARKER='' + MAX_CHECK_COMMENTS=3 + + # 1. 读取 PR body (避免在 yaml 中直接注入多行 payload) + PR_BODY=$(api "$API/repos/$OWNER/$NAME/pulls/$PR_NUM" | jq -r '.body // ""') + + # 2. 解析 pr-type + PR_TYPE=$(printf '%s\n' "$PR_BODY" | grep -oE 'pr-type:[[:space:]]*[A-Za-z_0-9]+' | head -1 | cut -d: -f2 | tr -d '[:space:]') + if [ -z "$PR_TYPE" ]; then + PR_TYPE_MISSING=1 + PR_TYPE=images + else + PR_TYPE_MISSING=0 + fi + + # 3. 自查清单 + CHECK_TOTAL=$(printf '%s\n' "$PR_BODY" | grep -cE '^[[:space:]]*-[[:space:]]*\[[ xX]\]' || true) + UNCHECKED=$(printf '%s\n' "$PR_BODY" | grep -E '^[[:space:]]*-[[:space:]]*\[[[:space:]]\][[:space:]]*(.*)$' | sed -E 's/^[[:space:]]*-[[:space:]]*\[[[:space:]]\][[:space:]]*/- /' || true) + + # 4. 变更文件列表 (分页) + FILES_TMP=$(mktemp) + page=1 + while :; do + resp=$(api "$API/repos/$OWNER/$NAME/pulls/$PR_NUM/files?limit=50&page=$page") + n=$(echo "$resp" | jq 'if type=="array" then length else 0 end') + echo "$resp" | jq -r '.[] | "\(.status // "unknown")\t\(.filename // "")"' >> "$FILES_TMP" || true + [ "$n" -lt 50 ] && break + page=$((page + 1)) + done + + ACTIVE_FILES=$(awk -F'\t' -v re="$ACTIVE_RE" '$1 ~ re {print $2}' "$FILES_TMP") + + expected_bucket() { + first=$(printf '%s' "$1" | cut -c1 | tr '[:lower:]' '[:upper:]') + case "$first" in + [A-Z]) echo "$first" ;; + *) echo '#' ;; + esac + } + + SECTIONS=() + FAILED=0 + + # 5. 清单检查 (所有 pr-type) + if [ "$CHECK_TOTAL" -eq 0 ]; then + FAILED=1 + SECTIONS+=("我们未在 PR 描述中找到自查清单, 请使用仓库提供的 Pull Request 模板, 勿删除清单项:\nWe could not find a checklist in the PR body. Please use the repository Pull Request template and do not remove the checklist items.") + elif [ -n "$UNCHECKED" ]; then + FAILED=1 + SECTIONS+=("我们注意到 PR 模板中的自查清单尚未全部勾选, 请确认并勾选后再次提交:\nWe noticed that the PR template checklist is incomplete. Please check all items and update the PR:\n\n$(printf '%s\n' "$UNCHECKED")") + fi + + # 6. 按 pr-type 检查 + case "$PR_TYPE" in + images) + IMAGES=$(printf '%s\n' "$ACTIVE_FILES" | grep -iE "$IMAGE_EXT_RE" || true) + if [ -z "$IMAGES" ]; then + FAILED=1 + if [ "$PR_TYPE_MISSING" -eq 1 ]; then + SECTIONS+=("PR 描述中未找到 pr-type 标签, 已按图片提交 (images) 处理; 但未检测到任何图片文件变更.\nNo pr-type tag was found in the PR body, so it was treated as an image submission (images); no changed image files were detected.\n\n若本次不是提交照片, 请关闭后把 pr-type 改为 ci_wf / docs / others.\nIf this PR is not for photos, please close it and set pr-type to ci_wf / docs / others.\n\n若确为图片提交, 请将图片放入对应目录后再 push.\nIf this is a photo submission, please add images under the proper folders and push again.") + else + SECTIONS+=("当前 PR 类型为图片提交 (pr-type: images), 但未检测到任何图片文件变更.\nThis PR is typed as an image submission (pr-type: images), but no changed image files were detected.\n\n若本次不是提交照片, 请关闭后把 pr-type 改为 ci_wf / docs / others.\nIf this PR is not for photos, please close it and set pr-type to ci_wf / docs / others.\n\n若确为图片提交, 请将图片放入对应目录后再 push.\nIf this is a photo submission, please add images under the proper folders and push again.") + fi + fi + + # 目录归类 + INVALID=() + while IFS= read -r file; do + [ -z "$file" ] && continue + parts0=$(printf '%s' "$file" | cut -d/ -f1) + parts1=$(printf '%s' "$file" | cut -d/ -f2) + parts_count=$(printf '%s' "$file" | awk -F/ '{print NF}') + case "$parts0" in + .gitea|.github|en-US) continue ;; + esac + if [ "$parts_count" -eq 1 ]; then + case "$parts0" in + .gitattributes|.gitignore|CONTRIBUTING.md|EXIF.md|GUIDE.md|LICENSE|README.md|Q\&A.md|PARTIAL_CLONE.md) continue ;; + esac + INVALID+=("- ${file}(文件应位于 A-Z/# 下的个人文件夹内)") + continue + fi + if [ "$parts_count" -lt 3 ]; then + INVALID+=("- ${file}(文件应位于 A-Z/# 下的个人文件夹内)") + continue + fi + expected=$(expected_bucket "$parts1") + if [ "$parts0" != "$expected" ]; then + INVALID+=("- ${file}(应位于 ${expected}/${parts1}/...)") + fi + done <<< "$ACTIVE_FILES" + + if [ "${#INVALID[@]}" -gt 0 ]; then + FAILED=1 + SECTIONS+=("我们注意到以下文件的目录归类不正确, 请调整路径后再次推送:\nWe noticed that the following files are not under the correct A-Z/# folder. Please fix the paths and push again:\n\n$(printf '%s\n' "${INVALID[@]}")\n\n正确示例 / Examples:\n- M/moe/photo.jpg\n- #/233/photo.jpg") + fi + ;; + ci_wf) + OUTSIDE=$(printf '%s\n' "$ACTIVE_FILES" | grep -vE '^(\.gitea/|$)' || true) + if [ -n "$OUTSIDE" ]; then + FAILED=1 + SECTIONS+=("当前 PR 类型为 CI / 工作流修改 (pr-type: ci_wf), 但检测到 \`.gitea/\` 目录之外的文件变更:\nThis PR is typed as a CI / workflow change (pr-type: ci_wf), but files outside \`.gitea/\` were changed:\n\n$(printf '%s\n' "$OUTSIDE" | sed 's/^/- /')\n\n请将非 CI 改动拆到其他 PR, 或把 pr-type 改为对应类型 (images / docs / others).\nPlease split non-CI changes into another PR, or switch pr-type to the matching type (images / docs / others).") + fi + ;; + docs|others) + echo "pr-type is \"$PR_TYPE\", only checklist rules apply." + ;; + *) + FAILED=1 + SECTIONS+=("未识别的 pr-type: \"$PR_TYPE\". 请使用模板中的 images / ci_wf / docs / others.\nUnrecognized pr-type: \"$PR_TYPE\". Please use images / ci_wf / docs / others from the template.") + ;; + esac + + # 7. 评论策略: 3 条 check 评论 → 维护者通知(一次) → 静默 + if [ "${#SECTIONS[@]}" -gt 0 ]; then + COMMENT_PAGE=1 + COMMENTS_TMP=$(mktemp) + while :; do + resp=$(api "$API/repos/$OWNER/$NAME/issues/$PR_NUM/comments?limit=50&page=$COMMENT_PAGE") + n=$(echo "$resp" | jq 'if type=="array" then length else 0 end') + echo "$resp" | jq -r '.[] | .body // ""' >> "$COMMENTS_TMP" || true + [ "$n" -lt 50 ] && break + COMMENT_PAGE=$((COMMENT_PAGE + 1)) + done + + CHECK_COUNT=$(grep -cF "$CHECK_COMMENT_MARKER" "$COMMENTS_TMP" || true) + NOTIFIED=$(grep -cF "$NOTIFY_MARKER" "$COMMENTS_TMP" || true) + + BODY_MSG=$(printf '%s\n\n---\n\n' "${SECTIONS[@]}") + BODY_MSG=${BODY_MSG%$'\n\n---\n\n'} + + if [ "$NOTIFIED" -gt 0 ]; then + echo "Maintainer already notified. Silent mode: no further comments." + elif [ "$CHECK_COUNT" -lt "$MAX_CHECK_COMMENTS" ]; then + COMMENT_JSON=$(jq -n --arg b "${BODY_MSG}\n\n${CHECK_COMMENT_MARKER}" '{"body": $b}') + api -X POST -d "$COMMENT_JSON" "$API/repos/$OWNER/$NAME/issues/$PR_NUM/comments" + else + # 读取维护者名单 + MAINTAINERS="" + MAINT_JSON=$(api "$API/repos/$OWNER/$NAME/contents/.gitea/MAINTAINERS.yml" || true) + if [ -n "$MAINT_JSON" ]; then + MAINTAINERS=$(echo "$MAINT_JSON" | jq -r '.content // ""' | base64 -d 2>/dev/null \ + | grep -oE '^[[:space:]]*-[[:space:]]*@?[A-Za-z0-9-]+[[:space:]]*$' \ + | sed -E 's/^[[:space:]]*-[[:space:]]*@?//; s/[[:space:]]*$//' \ + | sed 's/^/@/' | tr '\n' ' ') + fi + if [ -z "$MAINTAINERS" ]; then + MAINTAINERS='(MAINTAINERS.yml 中暂无维护者)' + fi + NOTIFY_JSON=$(jq -n --arg b "该 PR 已连续多次未通过内容检查, 请维护者人工处理:\nThis PR has repeatedly failed the content check. Please have a maintainer review it manually:\n\n${MAINTAINERS}\n\n在维护者处理前, 本检查将不再自动评论.\nThis check will stay silent until a maintainer takes over.\n\n${NOTIFY_MARKER}" '{"body": $b}') + api -X POST -d "$NOTIFY_JSON" "$API/repos/$OWNER/$NAME/issues/$PR_NUM/comments" + fi + fi + + if [ "$FAILED" -ne 0 ]; then + echo "PR content check failed." + exit 1 + fi + echo "PR content check passed." diff --git a/.gitea/workflows/fast-forward.yml b/.gitea/workflows/fast-forward.yml new file mode 100644 index 0000000..3488b60 --- /dev/null +++ b/.gitea/workflows/fast-forward.yml @@ -0,0 +1,77 @@ +# fast-forward for PR +# +# 维护者或写权限用户回复含 /fast-forward 的评论后, 调用平台 API 以变基 (rebase) +# 方式合并 PR, 保留原始提交与签名. 合并失败时评论说明原因. +# (纯 shell + 平台 API, 不依赖第三方 action) +# +# 要求: 平台启用 Gitea Actions 并注册 ubuntu runner. +name: fast-forward for PR + +on: + issue_comment: + types: [created, edited] + pull_request_review_comment: + types: [created, edited] + +jobs: + fast-forward: + if: > + contains(github.event.comment.body, '/fast-forward') && + (github.event.issue.pull_request || github.event.pull_request) + runs-on: ubuntu-latest + steps: + - name: Install jq + run: | + command -v jq && exit 0 + sudo apt-get install -y --no-install-recommends jq \ + || (sudo apt-get update && sudo apt-get install -y --no-install-recommends jq) + + - name: Check permission and merge + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ gitea.server_url || 'https://git.xhmcl.com' }}/api/v1 + REPO: ${{ github.repository }} + PR_NUM: ${{ github.event.issue.number || github.event.pull_request.number }} + COMMENT_USER: ${{ github.event.comment.user.login }} + run: | + set -euo pipefail + OWNER="${REPO%%/*}" + NAME="${REPO#*/}" + api() { curl -fsS -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "$@"; } + + comment() { + local msg="$1" + BODY_JSON=$(jq -n --arg b "$msg" '{"body": $b}') + api -X POST -d "$BODY_JSON" "$API/repos/$OWNER/$NAME/issues/$PR_NUM/comments" || true + } + + # 权限检查 (write 及以上) + perm=$(api "$API/repos/$OWNER/$NAME/collaborators/$COMMENT_USER/permission" 2>/dev/null | jq -r '.permission // "none"' || echo none) + case "$perm" in + admin|write|owner) ;; + *) + comment "**无法合并 (Merge rejected).** @$COMMENT_USER 没有该仓库的写权限, \`/fast-forward\` 仅限维护者使用. (You need write access to use \`/fast-forward\`.)" + exit 1 + ;; + esac + + # 变基合并 (Gitea 的 rebase 合并会保留原始提交与 GPG 签名) + HTTP_CODE=$(curl -sS -o "$RUNNER_TEMP/merge.json" -w '%{http_code}' \ + -X POST -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" \ + -d '{"Do":"rebase"}' "$API/repos/$OWNER/$NAME/pulls/$PR_NUM/merge") + + if [ "$HTTP_CODE" = "200" ]; then + MERGED=$(jq -r '.merged // false' "$RUNNER_TEMP/merge.json") + STATE=$(jq -r '.state // ""' "$RUNNER_TEMP/merge.json") + if [ "$MERGED" = "true" ] || [ "$STATE" = "closed" ]; then + comment "**合并完成 (Merged)!** 已以变基方式合并, 原始提交与签名得到保留. (Merged with rebase; original commits and signatures preserved.) 🎉" + exit 0 + fi + comment "**合并结果 (Merge result):** state=$STATE merged=$MERGED\n$(jq -r '.message // ""' "$RUNNER_TEMP/merge.json")" + exit 1 + fi + + # 非 200: 输出错误原因 + ERR_MSG=$(jq -r '.message // .error // "unknown error"' "$RUNNER_TEMP/merge.json" 2>/dev/null || echo "HTTP $HTTP_CODE") + comment "**合并失败 (Merge failed, HTTP $HTTP_CODE):**\n\n\`\`\`\n$ERR_MSG\n\`\`\`\n\n常见原因: 存在合并冲突、需要先变基到最新 main, 或检查未通过. 请先在本地 rebase 后再推送. (Common causes: conflicts, branch needs rebasing onto latest main, or checks failed.)" + exit 1 diff --git a/.gitea/workflows/greetings.yml b/.gitea/workflows/greetings.yml new file mode 100644 index 0000000..f364516 --- /dev/null +++ b/.gitea/workflows/greetings.yml @@ -0,0 +1,59 @@ +# Greetings +# +# 首次贡献者的 PR 欢迎评论. +# 纯 shell + 平台 API 实现, 不依赖第三方 action (无需从 GitHub 拉取任何内容). +# +# 要求: +# - 平台启用 Gitea Actions 并注册 ubuntu runner +# - 若 Gitea 版本不支持 pull_request_target, 请改为 pull_request +name: Greetings + +on: + pull_request_target: + types: [opened] + +jobs: + greeting: + runs-on: ubuntu-latest + steps: + - name: Install jq + run: | + command -v jq && exit 0 + sudo apt-get install -y --no-install-recommends jq \ + || (sudo apt-get update && sudo apt-get install -y --no-install-recommends jq) + + - name: Welcome first-time contributor + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ gitea.server_url || 'https://git.xhmcl.com' }}/api/v1 + REPO: ${{ github.repository }} + ACTOR: ${{ github.actor }} + PR_NUM: ${{ github.event.pull_request.number }} + run: | + set -euo pipefail + OWNER="${REPO%%/*}" + NAME="${REPO#*/}" + + api() { + curl -fsS -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "$@" + } + + # 统计该用户提交过的 PR 总数 (分页遍历) + total=0 + page=1 + while :; do + resp=$(api "$API/repos/$OWNER/$NAME/pulls?state=all&poster=$ACTOR&limit=50&page=$page") + n=$(echo "$resp" | jq 'if type=="array" then length else 0 end') + total=$((total + n)) + [ "$n" -lt 50 ] && break + page=$((page + 1)) + done + + if [ "$total" -le 1 ]; then + body=$(jq -n --arg u "@$ACTOR" \ + '{"body": ("你好 " + $u + ",感谢提交PR!\nHi " + $u + ", thanks for opening the Pull Request!\n我们会尽早审核回应😊\nWe will respond to it as soon as possible😊")}') + api -X POST -d "$body" "$API/repos/$OWNER/$NAME/issues/$PR_NUM/comments" + echo "Welcome comment posted for first PR of $ACTOR." + else + echo "Not the first PR of $ACTOR ($total PRs), skip." + fi diff --git a/.gitea/workflows/stale.yml b/.gitea/workflows/stale.yml new file mode 100644 index 0000000..301d7ea --- /dev/null +++ b/.gitea/workflows/stale.yml @@ -0,0 +1,101 @@ +# Mark Stale Pull Requests +# +# 每日定时扫描: 长期无活动的 PR 先标记并提醒, 7 天后仍未回应则关闭. +# (纯 shell + 平台 API; issue 不处理, 只处理 PR) +# +# 要求: 平台启用 Gitea Actions 并注册 ubuntu runner. +name: Mark stale pull requests + +on: + schedule: + - cron: '0 11 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - name: Install jq + run: | + command -v jq && exit 0 + sudo apt-get install -y --no-install-recommends jq \ + || (sudo apt-get update && sudo apt-get install -y --no-install-recommends jq) + + - name: Scan and mark stale PRs + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ gitea.server_url || 'https://git.xhmcl.com' }}/api/v1 + REPO: ${{ github.repository }} + STALE_DAYS: '30' + CLOSE_DAYS: '7' + run: | + set -euo pipefail + OWNER="${REPO%%/*}" + NAME="${REPO#*/}" + STALE_MARKER='' + now=$(date -u +%s) + stale_limit=$((STALE_DAYS * 86400)) + close_limit=$((CLOSE_DAYS * 86400)) + + api() { curl -fsS -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" "$@"; } + + to_epoch() { date -u -d "$1" +%s 2>/dev/null || echo 0; } + + post_comment() { + local num="$1" msg="$2" + BODY_JSON=$(jq -n --arg b "$msg" '{"body": $b}') + api -X POST -d "$BODY_JSON" "$API/repos/$OWNER/$NAME/issues/$num/comments" || true + } + + # 逐页遍历 open PR + page=1 + while :; do + prs=$(api "$API/repos/$OWNER/$NAME/pulls?state=open&limit=50&page=$page") + n=$(echo "$prs" | jq 'if type=="array" then length else 0 end') + + # 每个 PR 一行 JSON, 逐行处理 (避免空格的字段拆分问题) + while read -r pr_json; do + [ -z "$pr_json" ] && continue + num=$(echo "$pr_json" | jq -r '.number') + updated=$(echo "$pr_json" | jq -r '.updated_at // .created_at') + ts=$(to_epoch "$updated") + [ "$ts" = "0" ] && ts=$now + age=$((now - ts)) + + # 未到 stale 阈值, 跳过 + [ "$age" -lt "$stale_limit" ] && continue + + # 该 PR 最后一次 stale 标记评论的时间 + last_marker_ts=0 + cpage=1 + while :; do + comments=$(api "$API/repos/$OWNER/$NAME/issues/$num/comments?limit=50&page=$cpage") + cn=$(echo "$comments" | jq 'if type=="array" then length else 0 end') + while IFS=$'\t' read -r cts cbody; do + [ -z "$cts" ] && continue + cts_epoch=$(to_epoch "$cts") + [ "$cts_epoch" -gt "$last_marker_ts" ] && last_marker_ts="$cts_epoch" + done < <(echo "$comments" | jq -r '.[] | "\(.created_at // "")\t\(.body // "")"' | grep -F "$STALE_MARKER") + cpage=$((cpage + 1)) + [ "$cn" -lt 50 ] && break + done + + if [ "$last_marker_ts" -eq 0 ]; then + # 第一次标记: 评论提醒 + echo "Mark stale PR #$num" + post_comment "$num" "这个 PR 已许久未活跃, 请在 7 天内回应, 否则将被关闭。 + This PR has had no recent activity. Please respond within 7 days, otherwise it will be closed. + + $STALE_MARKER" + elif [ $((now - last_marker_ts)) -ge "$close_limit" ]; then + # 标记后超过 7 天仍未回应: 关闭 + echo "Close stale PR #$num" + api -X PATCH -d '{"state":"closed"}' "$API/repos/$OWNER/$NAME/issues/$num" || true + post_comment "$num" "这个 PR 因长期未活跃已关闭, 如需继续请重新打开。 + This PR has been closed due to long-term inactivity. Please reopen it if you wish to continue." + fi + done < <(echo "$prs" | jq -c '.[]') + + [ "$n" -lt 50 ] && break + page=$((page + 1)) + done + echo "Stale scan finished." diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4befed3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +.idea diff --git a/A/.gitkeep b/A/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/B/.gitkeep b/B/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/C/.gitkeep b/C/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a249fb2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,34 @@ +## 照片准则 + +- 不接受盗图和未授权转载他人图片 +- 萌即正义 +- 性别不限 + +### 隐私提醒 + +照片中有 EXIF 数据,会存储地理位置、拍照设备等信息。请留意意外的个人信息泄漏,push 照片前,请仔细检查照片的 EXIF 信息是否得到妥善处理。如果你不想公开这些信息,可以删除 EXIF。 + +> 如果平台启用了 Gitea Actions,本仓库的自动化检查会拦截 GPS、地址和联系方式等高敏感元数据。具体字段范围及敏感级别请查看 [EXIF 字段说明](EXIF.md)。 +> 平台未启用 Actions 时不会自动拦截,请务必**自行检查并清除**后再提交。 + +删除方法参考: + +> 1、使用 [GIMP](https://www.gimp.org/downloads/):打开 GIMP,导入需要处理的图片。点击「文件」 > 「导出为」,选择图片格式如 JPEG。在弹出的「导出图像」窗口中,点击「高级选项」。取消勾选「保存 EXIF 数据」。点击「导出」,保存图片时 EXIF 信息将被删除。 +> +> 2、使用命令行工具 [ExifTool](https://exiftool.org/):打开命令行(Windows 命令提示符、Mac/Linux 终端)。使用以下命令删除图片中的所有 EXIF 信息并保存为新文件: +> ```bash +> exiftool -all= -o new_image.jpg image.jpg +> ``` +> 3、使用在线工具:打开任意一个 EXIF 删除的在线工具网站,上传需要处理的图片文件,网站会自动处理图片并去除 EXIF 信息,下载处理后的图片即可。(如考虑到安全问题请采取其他方法) +> +> *(如果平台启用了 Actions,还可以在合并前使用 PR 评论区的 `/auto-fix` 命令自动去除 EXIF)* + +### 注意大小 Pay attention to case sensitivity + +为防止过度占用平台资源,请您在上传前留意照片大小,如大于 `1MB` 则您需要进行图片压缩。 + +压缩方法参考: + +> **使用在线工具:** 打开任意一个图片压缩的在线工具网站,上传需要处理的图片文件,网站会自动处理图片,下载处理后的图片即可。(如考虑到安全问题请采取其他方法) +> +> *(如果平台启用了 Actions,还可以在合并前使用 PR 评论区的 `/auto-fix` 命令自动压缩图片)* diff --git a/D/.gitkeep b/D/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/E/.gitkeep b/E/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/EXIF.md b/EXIF.md new file mode 100644 index 0000000..b36fee4 --- /dev/null +++ b/EXIF.md @@ -0,0 +1,91 @@ +# 📋 EXIF 是什么? + +## 简介 + +**EXIF**(Exchangeable Image File Format)是嵌入在图片文件中的一份「数字档案」。 +每次你用手机或相机拍照,设备会自动把拍摄时的各种信息记录进去——包括你**在哪里拍**、**用什么设备拍**、**什么时候拍**。 + +除了 EXIF 本身,图片还可能携带 **IPTC**、**XMP** 等元数据格式,同样能存储位置和个人信息。 + +照片提交准则和常用元数据清理方法请查看 [贡献准备](CONTRIBUTING.md)。 + +> ⚠️ 如果平台启用了 Gitea Actions,下方「高度敏感」字段会被本仓库的工作流自动检测,发现即要求修正。**平台未启用 Actions 时不会自动拦截,提交前请务必自查。** + +--- + +## 🔴 高度敏感 + +**这些字段会被自动检测(平台启用 Actions 时),发现即要求修正。** + +| 字段 | 说明 | +|---|---| +| `GPS:GPSLatitude` / `GPS:GPSLongitude` | 精确地理坐标,可定位到米级 | +| `GPS:GPSAltitude` | 海拔高度 | +| `GPS:GPSDateStamp` + `GPS:GPSTimeStamp` | 精确拍摄时刻(结合坐标可还原行踪)| +| `GPS:GPSSpeed` / `GPS:GPSTrack` / `GPS:GPSImgDirection` | 移动速度、方向 | +| `IPTC:City` / `IPTC:Country` / `IPTC:Sub-location` / `IPTC:Province-State` | 文字形式的拍摄地址 | +| `XMP-photoshop:City` / `XMP-photoshop:Country` / `XMP-photoshop:State` | Photoshop/Lightroom 写入的地址 | +| `XMP-iptcCore:CreatorWorkEmail` | Creator's work email | +| `XMP-iptcCore:CreatorWorkTelephone` | 创作者电话 | +| `XMP-iptcCore:CreatorCity` / `CreatorCountry` / `CreatorPostalCode` | 创作者通讯地址 | + +--- + +## 🟠 较敏感 + +**这些字段不会导致 PR 被拒,但建议留意——尤其是序列号类信息可以跨图片追踪到同一台设备。** + +| 字段 | 说明 | +|---|---| +| `EXIF:BodySerialNumber` / `EXIF:CameraSerialNumber` | 设备序列号,可跨图追踪 | +| `EXIF:LensSerialNumber` | 镜头序列号 | +| `EXIF:Artist` / `XMP-dc:Creator` | 拍摄者/创作者姓名 | +| `MakerNotes:FaceName` / `XMP-mwg-rs:PersonInImageName` | 相机人脸识别绑定的人名 | + +--- + +## 🟡 低度敏感 + +**通常对隐私影响较小,本项目不拦截,保留这些信息是可以接受的。** + +| 字段 | 说明 | +|---|---| +| `EXIF:DateTimeOriginal` | 拍摄时间(无位置时风险较低) | +| `EXIF:Make` / `EXIF:Model` | 相机/手机品牌型号 | +| `EXIF:Software` | 后期处理软件 | +| `EXIF:FNumber` / `EXIF:ExposureTime` / `EXIF:ISO` | 光圈、快门、感光度等摄影参数 | +| `EXIF:Copyright` | 版权声明 | + +--- + +## 🔍 如何自查 + +提交前可用以下命令查看图片中是否残留高敏感信息: + +```bash +# 安装 exiftool +# macOS: brew install exiftool +# Ubuntu: sudo apt install libimage-exiftool-perl +# Windows: https://exiftool.org/ + +# 检查单张图片 +exiftool -GPS:all -IPTC:City -IPTC:Country-PrimaryLocationName \ + -XMP-photoshop:City -XMP-iptcCore:CreatorWorkEmail your_photo.jpg + +# 若以上命令无任何输出,说明高敏感字段均已清除。 +``` + +### 完整清除所有元数据 +```bash +# 删除全部 EXIF/XMP/IPTC(最彻底) +exiftool -all= -o cleaned_photo.jpg your_photo.jpg +``` + +--- + +## 📖 延伸阅读 + +如果你对 EXIF 感兴趣,可以通过以下资源深入了解: + +- [ExifTool 官方文档](https://exiftool.org/) +- [EXIF(维基百科)](https://en.wikipedia.org/wiki/Exif) diff --git a/F/.gitkeep b/F/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/G/.gitkeep b/G/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/GUIDE.md b/GUIDE.md new file mode 100644 index 0000000..c3727e1 --- /dev/null +++ b/GUIDE.md @@ -0,0 +1,243 @@ +# 🌟 新手指南(PR 教程) + +欢迎来到小南娘项目!这份指南将帮助你完成第一次合并请求(Pull Request,简称 PR)。 + +> 本项目托管在自建平台 [git.xhmcl.com](https://git.xhmcl.com),基于 Gitea。流程和 GitHub 基本相同,但按钮位置和个别叫法略有差异,下文按 Gitea 的界面来写。 +> +> **重要:本平台只开放 HTTP(S),没有 SSH。** 所有克隆和推送都使用 `https://` 地址,你不需要配置任何 SSH Key。 + +--- + +## 📋 提交流程概览 + +``` +Fork(复刻)仓库 → 添加你的照片 → 提交 Commit → 发起合并请求(PR)→ 等待审核合并 +``` + +--- + +## 第一步:Fork 仓库 + +> **Fork(复刻)** = 把别人的仓库「复制」一份到你自己的账号下,让你可以自由修改喵,不会影响原项目喵! + +1. 打开 [小南娘仓库页面](https://git.xhmcl.com/xhgit/dress-pr) +2. 点击页面右上角的 **Fork(复刻)** 按钮 +3. 这会在你的账号下创建一份仓库副本,地址类似 `https://git.xhmcl.com/<你的用户名>/dress-pr` + +--- + +## 第二步:添加你的照片 + +> **Commit** = 给你的修改拍一张「快照」,记录你改了什么内容,每次 Commit 都会生成一条历史记录喵! + +### 方法 A:直接在网页上传(最简单,不需要安装任何东西) + +1. 进入你 Fork 后的仓库页面(`https://git.xhmcl.com/<你的用户名>/dress-pr`) +2. 根据计划使用的个人文件夹名称选择对应的首字母目录(如 `Yueosa` 进入 `Y`,数字或符号开头则进入 `#`) +3. 点击右上角的 **+**(添加文件)→ **新建文件(New File)** +4. 在文件名栏输入 `你的文件夹名/README.md`(如 `Yueosa/README.md`),这会自动创建文件夹;文件夹名无需与你的账号 ID 相同 +5. 在文件中随意写一些内容(如自我介绍) +6. 点击 **提交更改(Commit Changes)** +7. 再次点击 **+** → **上传文件(Upload File)**,将你的照片上传到刚创建的文件夹中 +8. 点击 **提交更改(Commit Changes)** + +### 方法 B:使用 Git 命令行 + +> **Clone** = 把远程仓库下载到本地电脑。 +> **Push** = 把本地的 Commit 上传同步到远程仓库(你的 Fork)。 + +```bash +# 1. 克隆你 Fork 的仓库(本平台只支持 HTTP 地址) +# 由于仓库 commit 历史较多,使用 --depth 1 仅拉取最近一次提交 +git clone --depth 1 https://git.xhmcl.com/<你的用户名>/dress-pr.git +cd dress-pr +``` + +如果你觉得仓库图片较多、普通克隆太慢,可以使用部分克隆代替上面的命令,只下载自己的目录: + +```bash +git clone --filter=blob:none --sparse --depth 1 https://git.xhmcl.com/<你的用户名>/dress-pr.git +cd dress-pr +git sparse-checkout set '<首字母>/<你的文件夹名>' +``` + +部分克隆不会影响正常提交和 PR。目录管理、完整历史和恢复完整仓库的方法请阅读[部分克隆指南](PARTIAL_CLONE.md)。 + +克隆完成后,创建你的文件夹并添加照片: + +```bash +# 2. 创建你的文件夹并添加照片 +# <首字母> 应与 <你的文件夹名> 的首字符对应;数字或符号开头时使用 # +mkdir -p <首字母>/<你的文件夹名> +cp /path/to/your/photos/* <首字母>/<你的文件夹名>/ + +# 3. 提交更改 +git add . +git commit -m "Add photos for <你的文件夹名>" + +# 4. 推送到你的 Fork +git push origin main +``` + +> 🔑 **推送时需要认证**:本平台没有 SSH,推送时 Git 会要求输入用户名和密码。密码**不是你的登录密码**,而是「访问令牌(Access Token)」: +> +> 1. 点击右上角头像 → **设置(Settings)** → **应用(Applications)** +> 2. 在「管理访问令牌 / Access Tokens」一栏点击 **生成令牌(Generate Token)** +> 3. 令牌名称随意填写;权限勾选仓库读写(Repository: read-write,若平台按细粒度列出,勾选 `repository` 下的读写权限) +> 4. 生成后**立即复制保存**,它只会显示这一次 +> 5. 推送时:用户名填你的账号名,密码粘贴这个令牌 + +--- + +## 第三步:发起合并请求(Pull Request) + +> **合并请求(Pull Request,PR)** = 向原仓库的维护者提出申请:「我在我的 Fork 里做了一些修改,请把它们合并到原项目里吧喵!」 + +1. 回到你 Fork 的仓库页面 +2. 点击 **合并请求(Pull Requests)** 标签 → **新建合并请求(New Pull Request)** + - 如果刚推送完,页面上通常会出现一条提示横幅,直接点上面的按钮即可 +3. 确认合并方向: + - **目标(base)**:`xhgit/dress-pr` 的 `main` 分支 + - **源(head)**:你的 Fork 仓库里你刚推送的分支 +4. 填写 PR 描述: + - 平台会自动填入仓库提供的 **PR 模板** + - **请勿删除模板顶部的 `` 标记行** + - 在模板的「自查清单 / Checklist」中**逐项勾选**(把 `[ ]` 改成 `[x]`) + - 本次不是交照片?把 `pr-type` 改为 `ci_wf` / `docs` / `others`,并按提示勾选清单 +5. 点击 **创建合并请求(Create Pull Request)** + +--- + +## 第四步:等待审核 + +提交照片类 PR 后,需要检查以下事项: + +- 📋 **PR 内容**:自查清单是否齐全并全部勾选、是否包含图片变更、文件是否位于对应的 `A-Z/#/昵称/` 目录下 +- 📏 **文件大小**:图片是否在 1 MiB(1 MB)以内 +- 🔒 **EXIF 信息**:图片是否包含高敏感元数据(主要是 **GPS 坐标**及地址类字段) + +> 如果平台启用了 Gitea Actions,以上检查会**自动运行**,检查结果直接显示在 PR 页面的「检查 / Checks」区域;未通过时 PR 下会留下评论说明原因。 +> 如果平台暂未启用 Actions,则由维护者人工检查,同样会在评论里说明原因。 + +检查未通过时,按提示修改后重新 **push**(网页上传则重新提交),检查会自动重跑。 + +如果平台启用了 Actions,还可以在评论区发送 **`/auto-fix`** 命令自动处理:将图片压缩到 1 MiB 以内,并去除**全部** EXIF(比检查更彻底)。若你不希望文件被改动,请自行处理好后再推送。 + +维护者审核通过后,你的 PR 就会被合并。恭喜你完成了一次开源贡献!🎉 + +--- + +## ⚠️ 提交前请注意 + +1. **压缩图片** — 确保每张图片小于 1 MiB。可以使用 [TinyPNG](https://tinypng.com/) 等在线工具压缩。 +2. **移除高敏感 EXIF 信息** — 最重要的是删除 **GPS 坐标**,它能精确暴露你的拍摄地点。照片还可能携带地址、联系方式等信息。详见 [EXIF 字段说明](EXIF.md) 和 [贡献准备中的清理方法](CONTRIBUTING.md)。 +3. **正确命名文件夹** — 使用有意义的文件夹名(无需与账号 ID 相同),并按其首字符放在对应的 `A-Z/#` 目录下。 +4. **原创图片** — 只提交你自己的照片,不接受盗图。 +5. **只修改自己的文件夹** — 请不要改动他人的文件夹或其他项目文件,避免给维护者带来不必要的麻烦。 +6. **文件名避免中文和空格** — 文件名中的中文字符或空格可能导致部分系统无法正常显示或下载,请尽量使用英文字母、数字和连字符。 +7. **推送用令牌,不用登录密码** — 命令行推送时密码位置填访问令牌(见第二步方法 B 的说明)。 + +--- + +## 🔗 参考链接 + +- [项目说明](README.md) +- [贡献准备](CONTRIBUTING.md) +- [EXIF 说明](EXIF.md) +- [Q&A](Q&A.md) +- [部分克隆指南](PARTIAL_CLONE.md) +- [已合并的 PR 参考](https://git.xhmcl.com/xhgit/dress-pr/pulls?state=closed) + +--- + +# 仓库 Workflow 流程(可选功能) + +> ⚠️ 本节内容依赖平台启用 **Gitea Actions** 并注册至少一个 Ubuntu runner。当前未启用时,以下自动化不运行,检查由维护者人工完成。工作流文件位于 [.gitea/workflows/](.gitea/workflows/)。 + +## 一、工作流体系总览 + +```mermaid +flowchart TD + ev1(["PR 开启 / 更新 / 重开 / 编辑"]) --> PRGRP + ev2(["PR 评论含指令"]) --> CMTGRP + ev3(["定时任务 每日 11:00 UTC"]) --> stale["Mark Stale
过期 PR 标记关闭"] + + subgraph PRGRP["PR 触发类 pull_request_target"] + greetings["Greetings
首次 PR 欢迎"] + check_pr_content["Check PR Content
清单+类型+目录"] + check_file_size["Check File Size
图片 ≤ 1 MiB"] + check_exif["Check EXIF
敏感元数据检查"] + end + + subgraph CMTGRP["评论触发类 issue_comment"] + auto_fix["Auto-fix
/auto-fix 修复图片"] + fast_forward["Fast-forward
/fast-forward 合并"] + end + + check_file_size -->|"评论提示"| auto_fix + check_exif -->|"评论提示"| auto_fix + auto_fix -.->|"push 后重跑"| check_file_size + auto_fix -.->|"push 后重跑"| check_exif +``` + +## 二、图片 PR 完整生命周期 + +```mermaid +flowchart TD + start(["贡献者提交 PR"]) --> prt["pull_request_target 触发"] + prt --> greet["Greetings
首次贡献欢迎"] + + prt --> content["Check PR Content"] + content --> c1{"自查清单
全部勾选?"} + c1 -->|否| failc["评论 + 检查失败"] + c1 -->|是| c2{"pr-type 规则"} + c2 -->|"images 需有图片变更
且目录归入 A-Z/#/昵称"| pass["检查通过"] + c2 -->|"ci_wf 变更限 .gitea/"| pass + c2 -->|"docs/others 仅查清单"| pass + c2 -->|不符合| failc + + prt --> size["Check File Size"] + size --> s1{"图片均 ≤ 1 MiB?"} + s1 -->|是| pass + s1 -->|否| fails["评论超限列表 + 失败"] + + prt --> exif["Check EXIF"] + exif --> e1{"含 GPS / 地址
联系方式等敏感 EXIF?"} + e1 -->|否| pass + e1 -->|是| faile["评论敏感列表 + 失败"] + + failc --> manual["作者手动修复并重新 push"] + manual --> prt + + fails --> cmd["维护者或 PR 作者
回复 /auto-fix"] + faile --> cmd + cmd --> af1["去除全部 EXIF"] + af1 --> af2{"压缩至 ≤ 1 MiB?"} + af2 -->|"成功"| af3["提交并 push 回 PR 分支"] + af2 -->|"20 次仍失败"| af4["整体回滚不 push
评论提示手动修复"] + af3 --> prt + + pass --> review["维护者审核"] + review --> ff["回复 /fast-forward
变基合并 保留原始提交"] + ff --> done(["合并完成"]) + + prt -.->|"长期无活动"| stale["每日定时扫描
标记 stale 7 天未回应则关闭"] +``` + +## 三、工作流一览 + +| 工作流 | 文件 | 触发方式 | 主要行为 | +| --- | --- | --- | --- | +| Greetings | `greetings.yml` | `pull_request_target` | 对首次贡献者的 PR 发送中英双语欢迎评论 | +| Check PR Content | `check_pr_content.yml` | `pull_request_target`(opened / synchronize / reopened / edited) | 所有类型 PR 须勾选自查清单;`images` 须有图片变更且目录符合 `A-Z/#/昵称/` 结构;`ci_wf` 变更须全部在 `.gitea/` 内;未识别的 `pr-type` 报错 | +| Check File Size | `check_file_size.yml` | `pull_request_target`(opened / synchronize / reopened) | 仅 `images` 类 PR:变更图片须全部 ≤ 1 MiB,超限则评论列出文件并提示 `/auto-fix`,检查失败 | +| Check Image EXIF Data | `check_exif.yml` | `pull_request_target`(opened / synchronize / reopened,同 PR 并发取消) | 仅 `images` 类 PR:下载变更图片,用 `exiftool` 检查 GPS、地址、联系方式等高敏感 EXIF;普通摄影参数不拦截;命中则评论并提示 `/auto-fix` | +| Auto-fix Image Files | `auto_fix.yml` | `issue_comment`(评论以 `/auto-fix` 开头,且为维护者或 PR 作者) | 检出 PR 分支 → `exiftool` 清除全部 EXIF → 循环压缩(`jpegoptim / pngquant / optipng / ImageMagick`,最多 20 次)至 ≤ 1 MiB → push 回 PR 分支触发检查重跑;压缩失败则整体回滚不 push 并评论说明 | +| Fast-forward for PR | `fast-forward.yml` | `issue_comment` / `pull_request_review_comment`(评论含 `/fast-forward`) | 校验评论者有 `write` 权限后调用平台 API 以变基(rebase)方式合并 PR,保留原始提交与签名;合并失败时评论说明原因 | +| Mark Stale Issues and PRs | `stale.yml` | `schedule`(cron: `0 11 * * *`) | 仅针对 PR:长期无活动先标记并提醒 7 天内回应,仍无回应则关闭(issue 不处理) | + +> **说明**: +> - pr-type 通过 PR 正文中的 `` 标签识别,取值为 `images / ci_wf / docs / others`,缺省按 `images` 处理。 +> - 所有工作流均为纯 shell + 平台 API 实现,不依赖任何第三方 action,无需从 GitHub 拉取任何内容。 +> - 若你的 Gitea 版本不支持 `pull_request_target` 事件,请把工作流里的 `pull_request_target` 改为 `pull_request`。 +> - `/auto-fix` 需要把图片 push 回 PR 分支,请预先在仓库「设置 → Actions → Secrets」中配置 `BOT_USER` 与 `BOT_TOKEN`(一个有 Fork 仓库写权限的账号令牌)。未配置时 `/auto-fix` 会提示无法推送。 diff --git a/H/.gitkeep b/H/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/I/.gitkeep b/I/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/J/.gitkeep b/J/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/K/.gitkeep b/K/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/L/.gitkeep b/L/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..523b8ca --- /dev/null +++ b/LICENSE @@ -0,0 +1,354 @@ + Attribution-NonCommercial-ShareAlike 4.0 International + + Creative Commons Corporation (“Creative Commons”) is not a law firm +anddoes not provide legal services or legal advice. Distribution of Creative +Commons public licenses does not create a lawyer-client or other +relationship. Creative Commons makes its licenses and related information +available on an “as-is” basis. Creative Commons gives no warranties +regarding its licenses, any material licensed under their terms and +conditions, or any related information. Creative Commons disclaims all +liability for damages resulting from their use to the fullest extent possible. + + Using Creative Commons Public Licenses + + Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share original +works of authorship and other material subject to copyright and certain other +rights specified in the public license below. The following considerations are +for informational purposes only, are not exhaustive, and do not form part of +our licenses. + + Considerations for licensors: Our public licenses are intended for use by +those authorized to give the public permission to use material in ways otherwise +restricted by copyright and certain other rights. Our licenses are irrevocable. +Licensors should read and understand the terms and conditions of the license they +choose before applying it. Licensors should also secure all rights necessary +before applying our licenses so that the public can reuse the material as expected. +Licensors should clearly mark any material not subject to the license. This +includes other CC-licensed material, or material used under an exception or +limitation to copyright. More considerations for licensors. + + Considerations for the public: By using one of our public licenses, a licensor +grants the public permission to use the licensed material under specified terms +and conditions. If the licensor’s permission is not necessary for any reason–for +example, because of any applicable exception or limitation to copyright–then that +use is not regulated by the license. Our licenses grant only permissions under +copyright and certain other rights that a licensor has authority to grant. Use of +the licensed material may still be restricted for other reasons, including because +others have copyright or other rights in the material. A licensor may make special +requests, such as asking that all changes be marked or described. Although not +required by our licenses, you are encouraged to respect those requests where +reasonable. More considerations for the public. + + TERMS AND CONDITIONS + + By exercising the Licensed Rights (defined below), You accept and agree to be +bound by the terms and conditions of this Creative Commons Attribution- +NonCommercial-ShareAlike 4.0 International Public License ("Public License"). +To the extent this Public License may be interpreted as a contract, You are +granted the Licensed Rights in consideration of Your acceptance of these terms +and conditions, and the Licensor grants You such rights in consideration of +benefits the Licensor receives from making the Licensed Material available under +these terms and conditions. + + Section 1 – Definitions. + + a. Adapted Material means material subject to Copyright and Similar Rights +that is derived from or based upon the Licensed Material and in which the +Licensed Material is translated, altered, arranged, transformed, or otherwise +modified in a manner requiring permission under the Copyright and Similar Rights +held by the Licensor. For purposes of this Public License, where the Licensed +Material is a musical work, performance, or sound recording, Adapted Material +is always produced where the Licensed Material is synched in timed relation +with a moving image. + + b. Adapter's License means the license You apply to Your Copyright and Similar +Rights in Your contributions to Adapted Material in accordance with the terms and +conditions of this Public License. + + c. BY-NC-SA Compatible License means a license listed at creativecommons.org/ +compatiblelicenses, approved by Creative Commons as essentially the equivalent +of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights closely +related to copyright including, without limitation, performance, broadcast, +sound recording, and Sui Generis Database Rights, without regard to how the +rights are labeled or categorized. For purposes of this Public License, the +rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + + e. Effective Technological Measures means those measures that, in the absence +of proper authority, may not be circumvented under laws fulfilling obligations +under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, +and/or similar international agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or any other +exception or limitation to Copyright and Similar Rights that applies to Your +use of the Licensed Material. + + g. License Elements means the license attributes listed in the name of a +Creative Commons Public License. The License Elements of this Public License +are Attribution, NonCommercial, and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, or +other material to which the Licensor applied this Public License. + + i. Licensed Rights means the rights granted to You subject to the terms and +conditions of this Public License, which are limited to all Copyright and Similar +Rights that apply to Your use of the Licensed Material and that the Licensor +has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights under +this Public License. + + k. NonCommercial means not primarily intended for or directed towards commercial +advantage or monetary compensation. For purposes of this Public License, the +exchange of the Licensed Material for other material subject to Copyright and +Similar Rights by digital file-sharing or similar means is NonCommercial provided +there is no payment of monetary compensation in connection with the exchange. + + l. Share means to provide material to the public by any means or process that +requires permission under the Licensed Rights, such as reproduction, public +display, public performance, distribution, dissemination, communication, or +importation, and to make material available to the public including in ways that +members of the public may access the material from a place and at a time +individually chosen by them. + + m. Sui Generis Database Rights means rights other than copyright resulting from +Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 +on the legal protection of databases, as amended and/or succeeded, as well as +other essentially equivalent rights anywhere in the world. + + n. You means the individual or entity exercising the Licensed Rights under this +Public License. Your has a corresponding meaning. + + Section 2 – Scope. + + 1. License grant. + + 1. Subject to the terms and conditions of this Public License, the Licensor + hereby grants You a worldwide, royaltyfree, non-sublicensable, non-exclusive, + irrevocable license to exercise the Licensed Rights in the Licensed Material to: + + 1. reproduce and Share the Licensed Material, in whole or in part, for + NonCommercial purposes only; and + + 2. produce, reproduce, and Share Adapted Material for NonCommercial + purposes only. + + 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and + Limitations apply to Your use, this Public License does not apply, and You do not + need to comply with its terms and conditions. + + 3. Term. The term of this Public License is specified in Section 6(a). + + 4. Media and formats; technical modifications allowed. The Licensor authorizes + You to exercise the Licensed Rights in all media and formats whether now known + or hereafter created, and to make technical modifications necessary to do so. + The Licensor waives and/or agrees not to assert any right or authority to forbid + You from making technical modifications necessary to exercise the Licensed + Rights, including technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, simply making + modifications authorized by this Section 2(a)(4) never produces Adapted Material. + + 5. Downstream recipients. + + 1. Offer from the Licensor – Licensed Material. Every recipient of the + Licensed Material automatically receives an offer from the Licensor to + exercise the Licensed Rights under the terms and conditions of this Public + License. + + 2. Additional offer from the Licensor – Adapted Material. Every recipient of + Adapted Material from You automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material under the conditions of + the Adapter’s License You apply. + + 3. No downstream restrictions. You may not offer or impose any additional or + different terms or conditions on, or apply any Effective Technological + Measures to, the Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed Material. + + 6. No endorsement. Nothing in this Public License constitutes or may be + construed as permission to assert or imply that You are, or that Your use of the + Licensed Material is, connected with, or sponsored, endorsed, or granted + official status by, the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + 2. Other rights. + + 1. Moral rights, such as the right of integrity, are not licensed under this + Public License, nor are publicity, privacy, and/or other similar personality + rights; however, to the extent possible, the Licensor waives and/or agrees not + to assert any such rights held by the Licensor to the limited extent necessary + to allow You to exercise the Licensed Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this Public License. + + 3. To the extent possible, the Licensor waives any right to collect royalties + from You for the exercise of the Licensed Rights, whether directly or through a + collecting society under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly reserves any right + to collect such royalties, including when the Licensed Material is used other + than for NonCommercial purposes. + + Section 3 – License Conditions + + Your exercise of the Licensed Rights is expressly made subject to the following +conditions. + + 1. Attribution. + + 1. If You Share the Licensed Material (including in modified form), You must: + + 1. retain the following if it is supplied by the Licensor with the Licensed + Material: + + 1. identification of the creator(s) of the Licensed Material and any + others designated to receive attribution, in any reasonable manner requested + by the Licensor (including by pseudonym if designated); + + 2. a copyright notice; + + 3. a notice that refers to this Public License; + + 4. a notice that refers to the disclaimer of warranties; + + 5. a URI or hyperlink to the Licensed Material to the extent reasonably + practicable; + + 2. indicate if You modified the Licensed Material and retain an indication + of any previous modifications; and + + 3. indicate the Licensed Material is licensed under this Public License, and + include the text of, or the URI or hyperlink to, this Public License. + + 2. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share Adapted Material + You produce, the following conditions also apply. + + 1. The Adapter’s License You apply must be a Creative Commons license with + the same License Elements, this version or later, or a BY-NC-SA Compatible + License. + + 2. You must include the text of, or the URI or hyperlink to, the Adapter's + License You apply. You may satisfy this condition in any reasonable manner + based on the medium, means, and context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms or + conditions on, or apply any Effective Technological Measures to, Adapted + Material that restrict exercise of the rights granted under the Adapter's + License You apply. + + Section 4 – Sui Generis Database Rights. + + Where the Licensed Rights include Sui Generis Database Rights that apply to Your +use of the Licensed Material: + + 1. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, +reuse, reproduce, and Share all or a substantial portion of the contents of the +database for NonCommercial purposes only; + + 2. if You include all or a substantial portion of the database contents in a +database in which You have Sui Generis Database Rights, then the database in which +You have Sui Generis Database Rights (but not its individual contents) is Adapted +Material, including for purposes of Section 3(b); and + + 3. You must comply with the conditions in Section 3(a) if You Share all or a +substantial portion of the contents of the database. + + For the avoidance of doubt, this Section 4 supplements and does not replace Your +obligations under this Public License where the Licensed Rights include other +Copyright and Similar Rights. + + Section 5 – Disclaimer of Warranties and Limitation of Liability. + + 1. Unless otherwise separately undertaken by the Licensor, to the extent +possible, the Licensor offers the Licensed Material as-is and as-available, and +makes no representations or warranties of any kind concerning the Licensed +Material, whether express, implied, statutory, or other. This includes, without +limitation, warranties of title, merchantability, fitness for a particular +purpose, non-infringement, absence of latent or other defects, accuracy, or the +presence or absence of errors, whether or not known or discoverable. Where +disclaimers of warranties are not allowed in full or in part, this disclaimer may +not apply to You. + + 2. To the extent possible, in no event will the Licensor be liable to You on any +legal theory (including, without limitation, negligence) or otherwise for any +direct, special, indirect, incidental, consequential, punitive, exemplary, or +other losses, costs, expenses, or damages arising out of this Public License or +use of the Licensed Material, even if the Licensor has been advised of the +possibility of such losses, costs, expenses, or damages. Where a limitation of +liability is not allowed in full or in part, this limitation may not apply to You. + + 3. The disclaimer of warranties and limitation of liability provided above shall +be interpreted in a manner that, to the extent possible, most closely approximates +an absolute disclaimer and waiver of all liability. + + Section 6 – Term and Termination + + 1. This Public License applies for the term of the Copyright and Similar Rights +licensed here. However, if You fail to comply with this Public License, then Your +rights under this Public License terminate automatically. + + 2. Where Your right to use the Licensed Material has terminated under Section +6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided it is cured + within 30 days of Your discovery of the violation; or + + 2. upon express reinstatement by the Licensor + + For the avoidance of doubt, this Section 6(b) does not affect any right the + Licensor may have to seek remedies for Your violations of this Public License. + + 3. For the avoidance of doubt, the Licensor may also offer the Licensed Material +under separate terms or conditions or stop distributing the Licensed Material at +any time; however, doing so will not terminate this Public License. + + 4. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + + Section 7 – Other Terms and Conditions. + + 1. The Licensor shall not be bound by any additional or different terms or +conditions communicated by You unless expressly agreed. + + 2. Any arrangements, understandings, or agreements regarding the Licensed +Material not stated herein are separate from and independent of the terms and +conditions of this Public License. + + Section 8 – Interpretation. + + 1. For the avoidance of doubt, this Public License does not, and shall not be +interpreted to, reduce, limit, restrict, or impose conditions on any use of the +Licensed Material that could lawfully be made without permission under this Public +License. + + 2. To the extent possible, if any provision of this Public License is deemed +unenforceable, it shall be automatically reformed to the minimum extent necessary +to make it enforceable. If the provision cannot be reformed, it shall be severed +from this Public License without affecting the enforceability of the remaining +terms and conditions. + + 3. No term or condition of this Public License will be waived and no failure to +comply consented to unless expressly agreed to by the Licensor. + + 4. Nothing in this Public License constitutes or may be interpreted as a +limitation upon, or waiver of, any privileges and immunities that apply to the +Licensor or You, including from the legal processes of any jurisdiction or +authority. + + Creative Commons is not a party to its public licenses. Notwithstanding, +Creative Commons may elect to apply one of its public licenses to material it +publishes and in those instances will be considered the “Licensor.” The text of +the Creative Commons public licenses is dedicated to the public domain under the +CC0 Public Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as otherwise permitted +by the Creative Commons policies published at creativecommons.org/policies, +Creative Commons does not authorize the use of the trademark “Creative Commons” or +any other trademark or logo of Creative Commons without its prior written consent +including, without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, understandings, or +agreements concerning use of licensed material. For the avoidance of doubt, this +paragraph does not form part of the public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/M/.gitkeep b/M/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/N/.gitkeep b/N/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/O/.gitkeep b/O/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/P/.gitkeep b/P/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/PARTIAL_CLONE.md b/PARTIAL_CLONE.md new file mode 100644 index 0000000..3737061 --- /dev/null +++ b/PARTIAL_CLONE.md @@ -0,0 +1,109 @@ +# 部分克隆指南 + +[English](en-US/PARTIAL_CLONE.md) + +小南娘仓库包含大量图片。只使用 `--depth 1` 会省略旧提交,但仍会下载当前版本中的全部图片。若你只准备修改自己的目录,推荐同时使用部分克隆和稀疏检出:Git 先下载提交与目录结构,仅在检出所选目录时按需下载其中的文件。 + +> 需要 Git 2.25 或更高版本。可运行 `git --version` 查看版本。 +> 本平台只开放 HTTP(S) 访问,请使用 `https://` 地址(下文均已给出)。 + +## 首次克隆 + +先在平台上 Fork 本仓库,再克隆你自己的 Fork。将命令中的用户名和目录替换为实际值: + +```bash +git clone --filter=blob:none --sparse --depth 1 https://git.xhmcl.com/<你的用户名>/dress-pr.git +cd dress-pr + +# 只检出自己的目录;即使远端尚无该目录,也可以先设置 +git sparse-checkout set '<首字母>/<你的文件夹名>' +``` + +例如,要使用 `Y/Yueosa`: + +```bash +git sparse-checkout set 'Y/Yueosa' +``` + +此时工作区会包含根目录文档和 `Y/Yueosa`,不会出现其他贡献者的图片。若文件夹名以数字或符号开头,请使用 `#` 目录,并务必给路径加引号: + +```bash +git sparse-checkout set '#/233' +``` + +接下来可以创建目录、添加照片并正常使用 `git add`、`git commit` 和 `git push`。完整贡献流程请继续阅读[新手指南](GUIDE.md)。 + +## 管理检出目录 + +查看当前选择的目录: + +```bash +git sparse-checkout list +``` + +追加另一个目录,同时保留已有目录: + +```bash +git sparse-checkout add 'A/AnotherName' +``` + +重新选择目录时,`set` 会替换之前的目录列表: + +```bash +git sparse-checkout set 'F/FirstName' 'S/SecondName' +``` + +Git 会在需要时自动下载新选目录中的文件,因此目录越小,下载量和磁盘占用通常越少。 + +## 获取更多历史 + +`--depth 1` 创建的是浅克隆,只包含最新一次提交。普通的添加照片和发起 PR 不受影响;若需要查看完整历史,可运行: + +```bash +git fetch --unshallow +``` + +这会获取完整提交历史,但图片内容仍由部分克隆按需下载。 + +## 恢复完整仓库 + +如果只想让当前版本的所有文件出现在工作区,可关闭稀疏检出: + +```bash +git sparse-checkout disable +``` + +该命令会下载当前版本中尚未获取的文件,数据量可能很大。仓库仍然保留部分克隆设置,旧版本文件会继续按需下载。 + +如果确实需要把仓库转换为包含全部历史和文件内容的完整克隆,可继续运行: + +```bash +git fetch --unshallow --no-filter +git config --unset remote.origin.partialclonefilter +git config --unset remote.origin.promisor +``` + +若之前已经执行过 `git fetch --unshallow`,再次执行时会提示仓库并非浅克隆;此时改用 `git fetch --no-filter` 即可。 + +## 常见问题 + +### 为什么根目录文档仍会出现? + +`git clone --sparse` 默认使用锥形模式。该模式会保留仓库根目录的文件,便于直接阅读 `README.md`、`GUIDE.md` 等说明文档。 + +### 为什么看不到刚选择的目录? + +先运行 `git sparse-checkout list` 核对路径、大小写和首字母目录。远端不存在的新目录不会自动显示,创建并加入文件后才会出现在工作区中。 + +### 部分克隆会影响提交或 PR 吗? + +不会。未检出的文件仍由 Git 管理,不会因为 `git add` 或提交自己的目录而被删除。请只修改自己的目录,并在提交前使用 `git status` 核对变更。 + +### 推送时提示认证失败? + +本平台没有 SSH,推送需使用 `https://` 地址并以「用户名 + 访问令牌」认证。令牌生成方法见[新手指南](GUIDE.md) 第二步方法 B。 + +## 参考 + +- [Git 官方文档:部分克隆](https://git-scm.com/docs/partial-clone) +- [Git 官方文档:稀疏检出](https://git-scm.com/docs/git-sparse-checkout) diff --git a/Q&A.md b/Q&A.md new file mode 100644 index 0000000..c91b5c2 --- /dev/null +++ b/Q&A.md @@ -0,0 +1,19 @@ +为什么??? +-------------- + +简而言之:我们鼓励更多人学习并理解 Git 与 Gitea 平台的核心理念,而无需编写代码。许多准程序员和非程序员也需要参与协作项目。因此,本项目非常适合他们进行实践,因为这里完全不需要编程技能。 + +这个项目会占用大量平台资源吗? +--------------- + +不会。贡献者在提交合并请求(Pull Request)前必须压缩照片。单个文件超过 1MB 或不符合我们标准的照片将被拒绝。这同时也作为对他们进行 Git 工作流程的一次培训。未来,我们可能会定期清理孤立对象,以保持仓库的可用性。 + +这个项目真的有帮助吗? +--------------- + +是的,我们认为如此。该项目已经引起了人们对 Git 协作的关注,并以通俗易懂的方式教会了很多人「Git 的理念与工作流程」以及「如何简单地使用 Git」。此外,该项目还培养了用户的团队协作能力:通过参与讨论,解决诸如 fork(复刻)、合并分支、控制仓库大小、维护仓库等问题。 + +如何加入我们? +--------------- + +请参考 [README.md](README.md) 和 [新手指南](GUIDE.md)。 diff --git a/Q/.gitkeep b/Q/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/R/.gitkeep b/R/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..f858db9 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +## 小南娘 - 面向可爱的蓝孩子 (/ω\) 的 git 学习实践项目 + +[English](en-US/README.md) + +> ***如果您对项目感到困惑或觉得奇怪,请阅读 [Q&A](Q&A.md)*** + +[![License](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-nc-sa/4.0/) + +项目托管在自建 Git 平台:[git.xhmcl.com/xhgit/dress-pr](https://git.xhmcl.com/xhgit/dress-pr) + +> 本平台只开放 HTTP(S) 访问,不提供 SSH。所有克隆、推送都使用 `https://` 地址,无需配置 SSH Key。完整流程见 [新手指南](GUIDE.md)。 + +项目很简单且并不要求你贡献代码,没有编程技能都可以参加。你可以从这里学习从克隆项目、创建分支、提交和同步修改,到合并分支请求的整套流程,一次即可熟悉 Git 和 Gitea 平台的使用。 + +**当然,你还要事先准备至少一张你的女装照。** + +### 文件夹命名规则和文件标准 + +- 不接受盗图和未授权转载他人图片 +- 请尽量使用有意义的文件夹名字 +- 可使用你的 Gitea 用户名或者其他社交平台上非中文的 ID 来命名文件夹 +- 文件夹按照首字母归类 +- 尽量不要在文件夹名字中出现空格 +- 影响排序的文件夹命名 (例如 ```AAAA.Folder```, ```0.Folder```, ```111Folder```) 会被 Close Pull Request +- 如果需要在你的文件夹内创建描述文件,请尽量使用 [Markdown](https://en.wikipedia.org/wiki/Markdown) 语法来编写 +- 图片请尽量压缩大小(1 MB 以下),并按 [EXIF 字段说明](EXIF.md) 移除高敏感信息(清理方法见 [贡献准备](CONTRIBUTING.md)),图片质量过低的 Pull Request 会被 Close + +### 自动化检查(可选功能) + +如果平台启用了 Gitea Actions 并注册了 runner,本仓库的 [工作流](.gitea/workflows) 会自动运行以下检查: + +- 📋 **PR 内容检查** — 自查清单、pr-type 标签、目录归类 +- 📏 **文件大小检查** — 图片是否在 1 MiB 以内 +- 🔒 **EXIF 信息检查** — 是否包含 GPS / 地址 / 联系方式等高敏感元数据 +- ✨ **`/auto-fix`** — 评论命令:自动压缩图片并清除全部 EXIF +- ⏩ **`/fast-forward`** — 评论命令:维护者快进合并 +- 🧹 **过期 PR 清理** — 长期无活动的 PR 自动提示并关闭 + +当前平台**未启用** Actions 时,以上检查由维护者人工完成。详见 [GUIDE.md](GUIDE.md) 的「仓库工作流」一节。 + +### 贡献者 + +感谢所有贡献者![查看贡献者列表](https://git.xhmcl.com/xhgit/dress-pr/activity/contributors) + +### 许可 + +本项目采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。 + +### 贡献准备 + +请仔细阅读[贡献准备](CONTRIBUTING.md) + +### 新手指南 + +第一次参与?请阅读 [新手指南](GUIDE.md),了解完整的 Fork → 提交 → 合并请求(Pull Request)流程。 + +使用 Git 命令行参与时,推荐阅读[部分克隆指南](PARTIAL_CLONE.md),只下载需要修改的目录以减少下载量和磁盘占用。 diff --git a/S/.gitkeep b/S/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/T/.gitkeep b/T/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/U/.gitkeep b/U/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/V/.gitkeep b/V/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/W/.gitkeep b/W/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/X/.gitkeep b/X/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Y/.gitkeep b/Y/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Z/.gitkeep b/Z/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/en-US/CONTRIBUTING.md b/en-US/CONTRIBUTING.md new file mode 100644 index 0000000..0c12dff --- /dev/null +++ b/en-US/CONTRIBUTING.md @@ -0,0 +1,31 @@ +## Photo Submission Criteria + +- Stolen pictures and unauthorized photos of other people are not accepted. +- Loveliness is righteous. +- Gender is unlimited. + +### Privacy Notice + +Please pay attention to preventing the accidental leakage of personal information. Please check carefully whether the EXIF information is properly handled (such as GPS tags) before you push the photo(s). If you want to delete EXIF, you can refer to the means below: + +If the platform has Gitea Actions enabled, the project's automated checks block high-sensitivity metadata such as GPS, address, and contact fields. See the [EXIF field guide](EXIF.md) for the exact scope and sensitivity levels. If Actions is not enabled, no automatic blocking happens — please inspect and clean your images yourself before submitting. + +> 1. Via [GIMP](https://www.gimp.org/downloads/):Open GIMP and import the image you want to edit. Go to "File" > "Export As" and choose a format like JPEG. In the "Export Image" window, click on "Advanced Options". Uncheck the "Save EXIF data" option. Click "Export" to save the image without EXIF data. +> +> 2. Via Command-Line Tool [ExifTool](https://exiftool.org/):Open the command prompt (Windows) or terminal (Mac/Linux). Use the following command to delete all EXIF information from the picture and save it as a new file: +> ```bash +> exiftool -all= -o new_image.jpg image.jpg +> ``` +> 3. Via Online Tools:Go to an online EXIF removal tool, upload the image you want to edit. The website will automatically remove the EXIF data, and you can then download the processed image. (If you consider safety issues, please take other methods) +> +> *(If Actions is enabled, you can also use the `/auto-fix` command in the PR comments to strip EXIF before merging.)* + +### Pay attention to size + +To prevent excessive resource usage on the platform, please check the photo size before uploading. If it exceeds `1MB`, you need to compress the image. + +Compression methods are as follows: + +> **Use an online tool:** Open any online image compression website, upload the image file you want to process, and the site will automatically compress it. Then, simply download the processed image. (If you have security concerns, please use alternative methods.) +> +> *(If Actions is enabled, you can also use the `/auto-fix` command in the PR comments to compress images automatically.)* diff --git a/en-US/EXIF.md b/en-US/EXIF.md new file mode 100644 index 0000000..aa567db --- /dev/null +++ b/en-US/EXIF.md @@ -0,0 +1,89 @@ +# 📋 What is EXIF? + +## Introduction + +**EXIF** (Exchangeable Image File Format) is a "digital dossier" embedded in image files. +Every time you take a photo with a phone or camera, the device automatically records information about the shot — including **where you took it**, **what device you used**, and **when you took it**. + +Besides EXIF itself, images may also carry metadata formats such as **IPTC** and **XMP**, which can store location and personal information as well. + +For submission criteria and common metadata cleaning methods, see [Contribution Preparation](CONTRIBUTING.md). + +> ⚠️ If the platform has Gitea Actions enabled, the "highly sensitive" fields below are detected automatically by the repository workflows and must be fixed. **If Actions is not enabled, no automatic blocking happens — please inspect your images yourself before submitting.** + +--- + +## 🔴 Highly Sensitive + +**These fields are detected automatically (when Actions is enabled) and must be removed.** + +| Field | Description | +|---|---| +| `GPS:GPSLatitude` / `GPS:GPSLongitude` | Exact geographic coordinates, locatable to meter level | +| `GPS:GPSAltitude` | Altitude | +| `GPS:GPSDateStamp` + `GPS:GPSTimeStamp` | Exact capture time (combined with coordinates can reconstruct movements) | +| `GPS:GPSSpeed` / `GPS:GPSTrack` / `GPS:GPSImgDirection` | Movement speed and direction | +| `IPTC:City` / `IPTC:Country` / `IPTC:Sub-location` / `IPTC:Province-State` | Textual shooting address | +| `XMP-photoshop:City` / `XMP-photoshop:Country` / `XMP-photoshop:State` | Address written by Photoshop/Lightroom | +| `XMP-iptcCore:CreatorWorkEmail` | Creator's work email | +| `XMP-iptcCore:CreatorWorkTelephone` | Creator's phone number | +| `XMP-iptcCore:CreatorCity` / `CreatorCountry` / `CreatorPostalCode` | Creator's contact address | + +--- + +## 🟠 Somewhat Sensitive + +**These fields won't cause a PR rejection, but please be aware — serial numbers in particular can track the same device across photos.** + +| Field | Description | +|---|---| +| `EXIF:BodySerialNumber` / `EXIF:CameraSerialNumber` | Device serial number, trackable across images | +| `EXIF:LensSerialNumber` | Lens serial number | +| `EXIF:Artist` / `XMP-dc:Creator` | Photographer/creator name | +| `MakerNotes:FaceName` / `XMP-mwg-rs:PersonInImageName` | Names bound by camera face recognition | + +--- + +## 🟡 Low Sensitivity + +**These have little privacy impact and are not blocked; keeping them is acceptable.** + +| Field | Description | +|---|---| +| `EXIF:DateTimeOriginal` | Capture time (low risk without location) | +| `EXIF:Make` / `EXIF:Model` | Camera/phone brand and model | +| `EXIF:Software` | Post-processing software | +| `EXIF:FNumber` / `EXIF:ExposureTime` / `EXIF:ISO` | Aperture, shutter speed, ISO and other photography parameters | +| `EXIF:Copyright` | Copyright notice | + +--- + +## 🔍 How to Self-Check + +Use the following commands before submitting to see whether high-sensitivity information remains: + +```bash +# Install exiftool +# macOS: brew install exiftool +# Ubuntu: sudo apt install libimage-exiftool-perl +# Windows: https://exiftool.org/ + +# Check a single image +exiftool -GPS:all -IPTC:City -IPTC:Country-PrimaryLocationName \ + -XMP-photoshop:City -XMP-iptcCore:CreatorWorkEmail your_photo.jpg + +# If the command above prints nothing, all high-sensitivity fields are cleaned. +``` + +### Remove All Metadata Completely +```bash +# Delete all EXIF/XMP/IPTC (the most thorough) +exiftool -all= -o cleaned_photo.jpg your_photo.jpg +``` + +--- + +## 📖 Further Reading + +- [ExifTool Official Documentation](https://exiftool.org/) +- [EXIF (Wikipedia)](https://en.wikipedia.org/wiki/Exif) diff --git a/en-US/GUIDE.md b/en-US/GUIDE.md new file mode 100644 index 0000000..8f613e4 --- /dev/null +++ b/en-US/GUIDE.md @@ -0,0 +1,173 @@ +# 🌟 Beginner Guide (PR Tutorial) + +Welcome to the XiaoNanNiang project! This guide will walk you through making your first Pull Request (PR). + +> This project is hosted on our self-hosted platform [git.xhmcl.com](https://git.xhmcl.com), which is based on Gitea. The workflow is essentially the same as GitHub's, but button positions and some wording differ slightly; the steps below follow the Gitea UI. +> +> **Important: the platform only serves HTTP(S) — there is no SSH.** Use `https://` URLs for all clones and pushes; you don't need to configure any SSH keys. + +--- + +## 📋 Workflow Overview + +``` +Fork the repository → Add your photos → Commit → Open a Pull Request (PR) → Wait for review & merge +``` + +--- + +## Step 1: Fork the Repository + +> **Fork** = copy someone else's repository to your own account so you can modify it freely without affecting the original project! + +1. Open the [XiaoNanNiang repository page](https://git.xhmcl.com/xhgit/dress-pr) +2. Click the **Fork** button in the top-right corner +3. This creates a copy under your account, at something like `https://git.xhmcl.com//dress-pr` + +--- + +## Step 2: Add Your Photos + +> **Commit** = a "snapshot" of your changes, recording what you modified. Each commit becomes a history entry! + +### Method A: Upload directly on the web (easiest, nothing to install) + +1. Go to your forked repository page (`https://git.xhmcl.com//dress-pr`) +2. Pick the first-letter directory matching your planned folder name (e.g. `Yueosa` goes into `Y`; names starting with digits or symbols go into `#`) +3. Click the **+** (add file) button in the top-right → **New File** +4. In the file name field, enter `your-folder-name/README.md` (e.g. `Yueosa/README.md`) — this creates the folder automatically; the folder name does not have to match your account ID +5. Write anything you like in the file (e.g. a self-introduction) +6. Click **Commit Changes** +7. Click **+** again → **Upload File**, and upload your photos into the folder you just created +8. Click **Commit Changes** + +### Method B: Using the Git command line + +> **Clone** = download the remote repository to your computer. +> **Push** = upload your local commits to the remote repository (your fork). + +```bash +# 1. Clone your fork (the platform only supports HTTP URLs) +# Use --depth 1 to fetch only the latest commit, since the repo history is large +git clone --depth 1 https://git.xhmcl.com//dress-pr.git +cd dress-pr +``` + +If the repository has too many images and a normal clone is too slow, you can use a partial clone instead to download only your own directory: + +```bash +git clone --filter=blob:none --sparse --depth 1 https://git.xhmcl.com//dress-pr.git +cd dress-pr +git sparse-checkout set '/' +``` + +Partial clone does not affect normal commits and PRs. For directory management, full history and restoring the complete repository, read the [Partial Clone Guide](PARTIAL_CLONE.md). + +After cloning, create your folder and add photos: + +```bash +# 2. Create your folder and add photos +# should match the first character of ; +# use # for names starting with digits or symbols +mkdir -p / +cp /path/to/your/photos/* // + +# 3. Commit your changes +git add . +git commit -m "Add photos for " + +# 4. Push to your fork +git push origin main +``` + +> 🔑 **Authentication for push**: the platform has no SSH, so Git will ask for a username and password when pushing. The password is **not your login password** — it's an "Access Token": +> +> 1. Click your avatar in the top-right → **Settings** → **Applications** +> 2. Under "Manage Access Tokens", click **Generate Token** +> 3. Name it anything; grant repository read-write permissions (check the read/write boxes under `repository` if permissions are granular) +> 4. **Copy the token immediately after generation** — it is shown only once +> 5. When pushing: username = your account name, password = the token + +--- + +## Step 3: Open a Pull Request + +> **Pull Request (PR)** = an application to the maintainers of the original repository: "I made some changes in my fork, please merge them into the original project!" + +1. Go back to your forked repository page +2. Click the **Pull Requests** tab → **New Pull Request** + - If you just pushed, a banner usually appears on the page — just click its button +3. Confirm the merge direction: + - **Base**: the `main` branch of `xhgit/dress-pr` + - **Head**: the branch you just pushed in your fork +4. Fill in the PR description: + - The platform auto-fills the repository's **PR template** + - **Do not delete the `` marker line at the top** + - Check every item in the "Checklist" section (change `[ ]` to `[x]`) + - Not submitting photos? Change `pr-type` to `ci_wf` / `docs` / `others` and follow the instructions in the template +5. Click **Create Pull Request** + +--- + +## Step 4: Wait for Review + +For photo PRs, the following items need to pass: + +- 📋 **PR content**: checklist complete and fully checked, image changes present, files under the matching `A-Z/#/nickname/` directory +- 📏 **File size**: images must be ≤ 1 MiB (1 MB) +- 🔒 **EXIF data**: images must not contain high-sensitivity metadata (mainly **GPS coordinates** and address fields) + +> If the platform has Gitea Actions enabled, these checks run **automatically**, and results appear in the "Checks" area of the PR page; failures are explained in comments. If Actions is not enabled, maintainers perform these checks manually and will also explain problems in comments. + +If a check fails, fix the problem and **push** again (or re-commit if using the web UI) — the checks re-run automatically. + +If Actions is enabled, you can also comment **`/auto-fix`** to fix issues automatically: it compresses images to under 1 MiB and strips **all** EXIF (more thorough than the check). If you don't want your files modified, fix them yourself and push again. + +Once a maintainer approves, your PR gets merged. Congratulations on your first open-source contribution! 🎉 + +--- + +## ⚠️ Before You Submit + +1. **Compress images** — make sure each image is under 1 MiB. Online tools like [TinyPNG](https://tinypng.com/) can help. +2. **Remove high-sensitivity EXIF** — most importantly **GPS coordinates**, which can pinpoint exactly where the photo was taken. Photos may also carry address and contact information. See the [EXIF field guide](EXIF.md) and the [cleaning methods in Contribution Preparation](CONTRIBUTING.md). +3. **Name folders correctly** — use meaningful folder names (they don't have to match your account ID) and place them under the matching `A-Z/#` directory by first character. +4. **Original photos only** — submit only your own photos; stolen pictures are not accepted. +5. **Only modify your own folder** — don't touch other people's folders or project files. +6. **Avoid Chinese characters and spaces in file names** — they can cause display or download problems on some systems. Prefer English letters, digits and hyphens. +7. **Use a token for push, not your login password** — see Step 2 Method B above. + +--- + +## 🔗 Reference Links + +- [Project README](README.md) +- [Contribution Preparation](CONTRIBUTING.md) +- [EXIF Guide](EXIF.md) +- [Q&A](Q&A.md) +- [Partial Clone Guide](PARTIAL_CLONE.md) +- [Merged PR examples](https://git.xhmcl.com/xhgit/dress-pr/pulls?state=closed) + +--- + +# Repository Workflows (Optional Feature) + +> ⚠️ This section depends on the platform having **Gitea Actions** enabled with at least one Ubuntu runner. When not enabled, the automation below does not run and maintainers check manually. The workflow files live in [.gitea/workflows/](../.gitea/workflows/). + +## Workflow Overview + +| Workflow | File | Trigger | Behavior | +| --- | --- | --- | --- | +| Greetings | `greetings.yml` | `pull_request_target` | Posts a bilingual welcome comment on a contributor's first PR | +| Check PR Content | `check_pr_content.yml` | `pull_request_target` (opened / synchronize / reopened / edited) | All PR types must have a fully checked checklist; `images` must include image changes under the `A-Z/#/nickname/` structure; `ci_wf` changes must stay inside `.gitea/`; unknown `pr-type` fails | +| Check File Size | `check_file_size.yml` | `pull_request_target` (opened / synchronize / reopened) | `images` PRs only: all changed images must be ≤ 1 MiB; oversized files are listed in a comment with a `/auto-fix` hint; check fails | +| Check Image EXIF Data | `check_exif.yml` | `pull_request_target` (opened / synchronize / reopened; concurrent runs cancelled) | `images` PRs only: downloads changed images and runs `exiftool` to detect GPS / address / contact metadata; regular photography parameters are fine; hits are commented with a `/auto-fix` hint | +| Auto-fix Image Files | `auto_fix.yml` | `issue_comment` (comment starting with `/auto-fix`, by a maintainer or the PR author) | Checks out the PR branch → strips all EXIF with `exiftool` → loops compression (`jpegoptim / pngquant / optipng / ImageMagick`, up to 20 attempts) down to ≤ 1 MiB → pushes back to the PR branch to re-trigger checks; on compression failure it reverts everything without pushing and comments the reason | +| Fast-forward for PR | `fast-forward.yml` | `issue_comment` / `pull_request_review_comment` (comment containing `/fast-forward`) | Verifies the commenter has `write` access, then merges the PR via the platform API with rebase, preserving original commits and signatures; comments on failure | +| Mark Stale PRs | `stale.yml` | `schedule` (cron: `0 11 * * *`) | PRs only: long-inactive PRs are marked with a warning and closed after 7 more days without a response (issues are not touched) | + +> **Notes**: +> - The pr-type is read from the `` tag in the PR body: `images / ci_wf / docs / others`; when missing it defaults to `images`. +> - All workflows are plain shell + platform API — no third-party actions, nothing fetched from GitHub. +> - If your Gitea version does not support the `pull_request_target` event, change it to `pull_request` in the workflow files. +> - `/auto-fix` needs to push back to the PR branch: configure the `BOT_USER` and `BOT_TOKEN` secrets in the repo's Settings → Actions → Secrets (a bot account token with write access to forks). Without them, `/auto-fix` comments an explanation and exits. diff --git a/en-US/PARTIAL_CLONE.md b/en-US/PARTIAL_CLONE.md new file mode 100644 index 0000000..3e886c2 --- /dev/null +++ b/en-US/PARTIAL_CLONE.md @@ -0,0 +1,109 @@ +# Partial Clone Guide + +[简体中文](../PARTIAL_CLONE.md) + +The XiaoNanNiang repository contains a large number of images. Using only `--depth 1` skips old commits but still downloads all images in the current version. If you only intend to modify your own directory, it's recommended to combine partial clone with sparse checkout: Git first downloads commits and the directory structure, and only fetches files on demand when the selected directory is checked out. + +> Requires Git 2.25 or higher. Run `git --version` to check. +> The platform only serves HTTP(S) — use the `https://` URLs below. + +## First Clone + +Fork this repository on the platform first, then clone your own fork. Replace the username and directory with actual values: + +```bash +git clone --filter=blob:none --sparse --depth 1 https://git.xhmcl.com//dress-pr.git +cd dress-pr + +# Check out only your own directory; you can set it even if it does not exist remotely yet +git sparse-checkout set '/' +``` + +For example, to use `Y/Yueosa`: + +```bash +git sparse-checkout set 'Y/Yueosa' +``` + +Now the working tree contains the root documents and `Y/Yueosa`, without other contributors' images. If the folder name starts with a digit or symbol, use the `#` directory and always quote the path: + +```bash +git sparse-checkout set '#/233' +``` + +Next you can create directories, add photos, and use `git add`, `git commit` and `git push` as usual. Continue to the [Beginner Guide](GUIDE.md) for the full contribution workflow. + +## Managing Checked-Out Directories + +View the currently selected directories: + +```bash +git sparse-checkout list +``` + +Add another directory while keeping existing ones: + +```bash +git sparse-checkout add 'A/AnotherName' +``` + +When re-selecting directories, `set` replaces the previous directory list: + +```bash +git sparse-checkout set 'F/FirstName' 'S/SecondName' +``` + +Git downloads files in newly selected directories as needed, so the smaller the directory, the less download and disk usage. + +## Getting More History + +`--depth 1` creates a shallow clone containing only the latest commit. Normal photo submission and PRs are unaffected; if you need the full history, run: + +```bash +git fetch --unshallow +``` + +This fetches the complete commit history, while image contents are still fetched on demand by the partial clone. + +## Restoring the Full Repository + +If you just want all files of the current version in the working tree, disable sparse checkout: + +```bash +git sparse-checkout disable +``` + +This downloads files not yet fetched for the current version and can be large. The repository keeps its partial clone settings, and old-version files continue to be fetched on demand. + +If you really need to convert the repository to a full clone with all history and contents, continue with: + +```bash +git fetch --unshallow --no-filter +git config --unset remote.origin.partialclonefilter +git config --unset remote.origin.promisor +``` + +If you already ran `git fetch --unshallow`, it will tell you the repository is not shallow; use `git fetch --no-filter` instead. + +## FAQ + +### Why do root documents still appear? + +`git clone --sparse` uses cone mode by default. This mode keeps the repository root files so you can read `README.md`, `GUIDE.md` and other documentation directly. + +### Why can't I see the directory I just selected? + +Run `git sparse-checkout list` first to check the path, case and first-letter directory. New directories that don't exist remotely won't appear automatically; they show up in the working tree only after you create and add files. + +### Does partial clone affect commits or PRs? + +No. Files that are not checked out are still managed by Git and won't be deleted when you `git add` or commit your own directory. Only modify your own directory, and check your changes with `git status` before committing. + +### Push fails with an authentication error? + +The platform has no SSH. Push with the `https://` URL and authenticate with "username + access token". See Step 2 Method B of the [Beginner Guide](GUIDE.md) for how to generate a token. + +## References + +- [Git Documentation: Partial Clone](https://git-scm.com/docs/partial-clone) +- [Git Documentation: Sparse Checkout](https://git-scm.com/docs/git-sparse-checkout) diff --git a/en-US/Q&A.md b/en-US/Q&A.md new file mode 100644 index 0000000..8a4591f --- /dev/null +++ b/en-US/Q&A.md @@ -0,0 +1,29 @@ +WHY??? +-------------- + +In short: We're encouraging more people to learn and understand the core ideas of Git and the Gitea platform without coding. + +There are quasi-programmers and non-programmers who need to participate in collaborative projects. So it's exactly suitable to practice in this project because no coding skills are required here. + +Will this project take up a lot of platform resources? +--------------- + +No. + +Contributors are required to compress their photos before making pull requests. Photos which are larger than 1MB per file or don't meet our standard will be rejected. It's also considered to be a training course of the Git workflow for them. + +In the future, we might clean orphaned objects regularly to keep the availability of the repo. + +Is this project really helpful? +--------------- + +Yes, we think so. + +This project has drawn attention to Git collaboration and taught lots of people "the ideas and the workflow of Git" and "how to use Git simply" in an easy-to-understand way. + +This project has also developed users' team cooperation ability: Join the discussion and solve problems such as forking, merging branches, controlling the size of repos, maintaining repos, and so on. + +How to join us? +--------------- + +Please refer to [README.md](README.md) and the [Beginner Guide](GUIDE.md). diff --git a/en-US/README.md b/en-US/README.md new file mode 100644 index 0000000..9bd2702 --- /dev/null +++ b/en-US/README.md @@ -0,0 +1,57 @@ +## XiaoNanNiang - A Study and Practice Project of Git for Cute Boys (/ω\) + +[简体中文](../README.md) + +> ***If you are feeling puzzled and weird about the project, please read [Q&A](Q&A.md)*** + +[![License](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-nc-sa/4.0/) + +Hosted on our self-hosted Git platform (based on Gitea): [git.xhmcl.com/xhgit/dress-pr](https://git.xhmcl.com/xhgit/dress-pr) + +> The platform only serves HTTP(S) — there is no SSH. Use `https://` URLs for all clone/push operations; no SSH key setup is needed. See the [Beginner Guide](GUIDE.md) for the full walkthrough. + +This simple repository requires no contribution of code, so that you can participate in it without having any coding skills. This project helps you to learn the whole process of cloning a repository, creating a branch, pushing and pulling commits, and making a pull request, thus you can have a good knowledge of Git and the Gitea platform. + +**Of course, you need to prepare a photo of you dressed in women's clothing first.** + +### File and Folder Naming Rules and Filetype Standards + +- Stolen pictures and unauthorized photos of other people are not accepted +- Please attempt to use meaningful folder names +- Use your platform username or roman character social media IDs as folder names +- Folders are organized alphabetically +- Please try to avoid spaces in folder names +- Pull requests with folder names that attempt to influence ordering (ex: ```AAAA.Folder```, ```0.Folder```, ```111Folder```) will be closed +- If you need to add a descriptive file in your folder, please compose it using [Markdown](https://en.wikipedia.org/wiki/Markdown). +- Please attempt to compress your images (less than 1 MB) and remove high-sensitivity metadata listed in the [EXIF field guide](EXIF.md) using the [removal methods](CONTRIBUTING.md); pull requests with excessively large image files will be closed + +### Automated Checks (Optional) + +If the platform has Gitea Actions enabled with a registered runner, the [workflows](../.gitea/workflows) run automatically: + +- 📋 **PR Content Check** — checklist, pr-type tag, folder placement +- 📏 **File Size Check** — images must be ≤ 1 MiB +- 🔒 **EXIF Check** — blocks high-sensitivity metadata (GPS / address / contact) +- ✨ **`/auto-fix`** — comment command: compress images and strip all EXIF automatically +- ⏩ **`/fast-forward`** — comment command: maintainer rebase-merge +- 🧹 **Stale PR Cleanup** — warn and close long-inactive PRs + +When Actions is not enabled, maintainers perform these checks manually. See the "Workflows" section of [GUIDE.md](GUIDE.md). + +### Contributors + +Thanks to all contributors! [View the contributor list](https://git.xhmcl.com/xhgit/dress-pr/activity/contributors) + +### License + +This repository is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. + +### Contribution Preparation + +Please read [Contribution Preparation](CONTRIBUTING.md) carefully. + +### Beginner Guide + +First time contributing? Read the [Beginner Guide](GUIDE.md) for a step-by-step walkthrough of the Fork → Commit → Pull Request workflow. + +When contributing with the Git CLI, read the [Partial Clone Guide](PARTIAL_CLONE.md) to download only the directory you need and reduce network transfer and disk usage.