增加对githubassets的支持 #8

Merged
LambdaYH merged 4 commits from main into main 2025-04-08 08:07:45 +08:00
LambdaYH commented 2025-04-07 14:13:19 +08:00 (Migrated from github.com)

Summary by CodeRabbit

  • New Features
    • Enhanced deployment consistency by standardizing image tag formatting.
    • Expanded asset URL recognition to support a broader range of asset domains.
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced deployment consistency by standardizing image tag formatting. - Expanded asset URL recognition to support a broader range of asset domains. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2025-04-07 14:13:36 +08:00 (Migrated from github.com)

Walkthrough

This pull request introduces two distinct changes. In the GitHub Actions workflow, a new step converts the repository name to lowercase and stores it in the REPO_LOWER environment variable. The Docker image tagging in the build and push step has been updated to use REPO_LOWER. Additionally, in the ghproxy/main.go file, a new regular expression pattern has been added to match URLs associated with GitHub assets domains.

Changes

File(s) Change Summary
.github/workflows/docker-ghcr.yml Added a step to convert the repository name to lowercase and set REPO_LOWER. Updated Docker image tag references to use REPO_LOWER.
ghproxy/main.go Added a new regular expression to the URL matching list to handle URLs from github.githubassets.com or opengraph.githubassets.com.

Sequence Diagram(s)

sequenceDiagram
    participant Workflow as GitHub Workflow
    participant Shell as Shell Command
    participant DockerStep as Docker Build & Push Step

    Workflow->>Shell: Convert github.repository to lowercase
    Shell-->>Workflow: Provide REPO_LOWER
    Workflow->>DockerStep: Build Docker image using REPO_LOWER
    DockerStep-->>Workflow: Tag and push Docker image

Poem

I hopped through code with glee,
Lowercasing names so perfectly free,
Docker images now wear tags so neat,
And regex catches new URLs on beat,
A bunny’s cheer for changes complete! 🐰

Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough This pull request introduces two distinct changes. In the GitHub Actions workflow, a new step converts the repository name to lowercase and stores it in the `REPO_LOWER` environment variable. The Docker image tagging in the build and push step has been updated to use `REPO_LOWER`. Additionally, in the `ghproxy/main.go` file, a new regular expression pattern has been added to match URLs associated with GitHub assets domains. ## Changes | File(s) | Change Summary | |----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| | `.github/workflows/docker-ghcr.yml` | Added a step to convert the repository name to lowercase and set `REPO_LOWER`. Updated Docker image tag references to use `REPO_LOWER`. | | `ghproxy/main.go` | Added a new regular expression to the URL matching list to handle URLs from `github.githubassets.com` or `opengraph.githubassets.com`. | ## Sequence Diagram(s) ```mermaid sequenceDiagram participant Workflow as GitHub Workflow participant Shell as Shell Command participant DockerStep as Docker Build & Push Step Workflow->>Shell: Convert github.repository to lowercase Shell-->>Workflow: Provide REPO_LOWER Workflow->>DockerStep: Build Docker image using REPO_LOWER DockerStep-->>Workflow: Tag and push Docker image ``` ## Poem > I hopped through code with glee, > Lowercasing names so perfectly free, > Docker images now wear tags so neat, > And regex catches new URLs on beat, > A bunny’s cheer for changes complete! 🐰 <!-- walkthrough_end --> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEejqANiS6A8jUAFSoE/tIutjYBaRIhK5EgELdA9KaAgMYGAHLYzAKUXAAcBgCqXhRcADJoEbRoAJoAEkb6xuBQZPT4AGY4BMRkyjT0TKzsXLz8wqLiUjLyTEpUqupaOvkmUHCoqJgVhKTkVLUKDRickFQA7pCI4cxoFPJyCj0qapraumCGBaYGGs64rgIA9Cv4FADWpRb4K4j3tPgML5RiLAGBQNLJmBYOAYAES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zy041ctC7huBZ7qAsNAsmG1+AAC8mTbDU5PEJv5CJKN6wLA9pB8SA3R7iC5R5eLEH9hhvMm35AY9skKVZI13SZGn6CQKEU0v6WDExvGNAAWQDXAAGEWA5qwAAoUwAPQ/gB+DgsBVbcEQAA+49wACUf8P6nQEAAHz9gHIOsAIEAB1Q53Ajj4dB9R7gfwANrf3uAAXQANQQPuBoUhf80wpggSeAwl9noGFGMgJGHoKS/GpBgfAyoCyeSkK2eQA1ZK5RVqTGQeApqT0ZLnRgaBiZqAmrgMu54FHt18p3V8cofqyPTuFZqWluSyH9r1colc941TqsiBqNQeqtVVO1HGWizF8yGnMUaf4sKTXYDNOab0Fpyi0o1FxDjOGiGcRFVxeNngeL4F4lmU1xDiGpCaECWwlDdhgm6UopRqpgzyGcC4RQ2wEjQHgKY1RZjYnqGtLgqwcTwxLHsboyg+jHEGEU4YEZ1ALngLQRAC4Cz9jgnQBclslSnHON00oDBojRFoAAZloAABgAGwkAAKybLWZsgALKUPZABOEgpQSAAEYVnnIEIsxZDBzmLIAEwPJIEclZJA9mPPoPkAw3Tam9P6YM4Zs0TS0AXMUKZQA --> <!-- internal state end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing Touches</summary> - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings </details> <!-- finishing_touch_checkbox_end --> <!-- tips_start --> --- Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <details> <summary>🪧 Tips</summary> ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=sky22333/hub-proxy&utm_content=8): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit <commit_id>, please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai plan` to trigger planning for file edits and PR creation. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. </details> <!-- tips_end -->
coderabbitai[bot] (Migrated from github.com) reviewed 2025-04-07 14:16:20 +08:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/docker-ghcr.yml (1)

57-57: Missing newline at end of file

The file is missing a newline character at the end, which is considered a best practice for text files.

  GHCR_PUBLIC: true  # 将镜像设置为公开
+
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 57-57: no new line character at the end of file

(new-line-at-end-of-file)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d9724c657c and fc88d3d06e.

📒 Files selected for processing (2)
  • .github/workflows/docker-ghcr.yml (1 hunks)
  • ghproxy/main.go (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/docker-ghcr.yml

[error] 57-57: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (3)
ghproxy/main.go (1)

35-35: Good addition for supporting GitHub assets domains

This new regular expression pattern extends the proxy's capabilities to handle requests for content from GitHub's asset domains (github.githubassets.com and opengraph.githubassets.com). The pattern follows the same structure as existing patterns, capturing the subdomain and path segment appropriately for use with the whitelist/blacklist checking mechanism.

.github/workflows/docker-ghcr.yml (2)

41-46: Good practice for Docker image naming

Converting the repository name to lowercase is necessary as Docker image names must be lowercase according to Docker specifications. This change ensures that the image can be successfully pushed to the GitHub Container Registry regardless of the case in the repository name.


52-54: Properly updated tags to use lowercase repository name

The Docker image tags have been correctly updated to use the lowercase repository name. This change works well with the previous step and ensures consistency in the image naming.

**Actionable comments posted: 0** <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>.github/workflows/docker-ghcr.yml (1)</summary><blockquote> `57-57`: **Missing newline at end of file** The file is missing a newline character at the end, which is considered a best practice for text files. ```diff GHCR_PUBLIC: true # 将镜像设置为公开 + ``` <details> <summary>🧰 Tools</summary> <details> <summary>🪛 YAMLlint (1.35.1)</summary> [error] 57-57: no new line character at the end of file (new-line-at-end-of-file) </details> </details> </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between d9724c657c6d118af67f891057df43a676b718e5 and fc88d3d06e55654f49efe101b33c13213e90e42d. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `.github/workflows/docker-ghcr.yml` (1 hunks) * `ghproxy/main.go` (1 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🪛 YAMLlint (1.35.1)</summary> <details> <summary>.github/workflows/docker-ghcr.yml</summary> [error] 57-57: no new line character at the end of file (new-line-at-end-of-file) </details> </details> </details> <details> <summary>🔇 Additional comments (3)</summary><blockquote> <details> <summary>ghproxy/main.go (1)</summary> `35-35`: **Good addition for supporting GitHub assets domains** This new regular expression pattern extends the proxy's capabilities to handle requests for content from GitHub's asset domains (`github.githubassets.com` and `opengraph.githubassets.com`). The pattern follows the same structure as existing patterns, capturing the subdomain and path segment appropriately for use with the whitelist/blacklist checking mechanism. </details> <details> <summary>.github/workflows/docker-ghcr.yml (2)</summary> `41-46`: **Good practice for Docker image naming** Converting the repository name to lowercase is necessary as Docker image names must be lowercase according to Docker specifications. This change ensures that the image can be successfully pushed to the GitHub Container Registry regardless of the case in the repository name. --- `52-54`: **Properly updated tags to use lowercase repository name** The Docker image tags have been correctly updated to use the lowercase repository name. This change works well with the previous step and ensures consistency in the image naming. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: 3344/hubproxy#8