Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: checkout old version #43

Merged

Conversation

chenchongbiao
Copy link
Collaborator

@chenchongbiao chenchongbiao commented Jul 8, 2024

更新工作流切出旧版本的文档。

Log: update docs

Summary by CodeRabbit

  • Chores
    • Updated the workflow process for checking out different repository versions. This includes:
      • Replacing direct checkout with a loop based on version-commit mapping.
      • Adding a step to clone the repository into specific directories for each version.
      • Introducing environment variables to facilitate the new process.

Copy link

coderabbitai bot commented Jul 8, 2024

Warning

Rate limit exceeded

@chenchongbiao has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 47 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between f99fdcd and 7393375.

Walkthrough

The primary update to the .github/workflows/pages.yml workflow involves a change in the repository checkout process. The previous matrix strategy for checking out multiple versions has been replaced with a dynamic loop that clones and checks out specific directories for each version using a version-commit mapping.

Changes

File Path Change Summary
.github/workflows/pages.yml Significant changes in the checkout process: replaced matrix strategy with a loop, cloned based on version-commit mapping, and added a run step with a loop.

Poem

In a workflow's quiet dance, a change came to enhance,
A loop replaced the matrix scheme, checked out directories like a dream.
Tokens, commits, versions precise, the code now so concise.
Bravo to this new delight, a simpler path, a coder’s night. 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (1)
.github/workflows/pages.yml (1)

23-24: Clarify the step name.

The step name "Checkout linglong old version" might be misleading. Consider adding more context to clarify its purpose.

- name: Checkout linglong old version
+ name: Checkout linglong old versions based on version-commit mapping
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 085eaf7 and 6a0c174.

Files selected for processing (1)
  • .github/workflows/pages.yml (1 hunks)
Additional comments not posted (3)
.github/workflows/pages.yml (3)

41-42: Ensure proper usage of GITHUB_TOKEN.

The GITHUB_TOKEN environment variable is correctly set. Ensure that it is used securely and not exposed in logs.


Line range hint 43-50:
Ensure no conflicts with previous checkout step.

The checkout step for the release version is correctly configured. Ensure that it does not conflict with the previous step and that the paths are correctly set.


31-40: Ensure the directories are correctly checked out.

The loop mechanism seems correct, but ensure that the directories are correctly checked out and there are no side effects. Additionally, consider adding error handling for the git commands.

Verification successful

Ensure the directories are correctly checked out.

The directories are correctly checked out when using valid branches. However, the initial issue was due to using a non-existent branch "main". Ensure that the script dynamically uses valid branches or includes error handling for non-existent branches.

  • Ensure the branches used in the script exist in the repository.
  • Add error handling for the git commands to manage cases where branches do not exist.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the loop mechanism and git commands.

# Test: Check for the existence of directories after the loop.
# Expect: Directories corresponding to each version should exist.
for version in "1.5.0"; do
    if [ ! -d "$version" ]; then
        echo "Directory $version does not exist."
        exit 1
    fi
done

echo "All directories exist."

Length of output: 129


Script:

#!/bin/bash
# Description: Verify the branches in the repository and the sparse-checkout configuration.

# Check if the repository exists
if ! git ls-remote https://github.com/OpenAtomFoundation/linglong.git &> /dev/null; then
    echo "Repository does not exist or is not accessible."
    exit 1
fi

# List all branches in the repository
echo "Listing all branches in the repository:"
git ls-remote --heads https://github.com/OpenAtomFoundation/linglong.git

# Clone the repository to a specific branch and check the sparse-checkout configuration
branch="main" # Assuming 'main' as the default branch, replace with the correct branch name if different
git clone --single-branch --branch $branch --depth 1 --filter=blob:none --sparse https://github.com/OpenAtomFoundation/linglong.git test_clone
cd test_clone
git sparse-checkout set en guide
cd ..
ls -la test_clone

Length of output: 1468


Script:

#!/bin/bash
# Description: Verify the cloning and sparse-checkout configuration using an existing branch.

# Clone the repository to a specific branch and check the sparse-checkout configuration
branch="release/1.5"
git clone --single-branch --branch $branch --depth 1 --filter=blob:none --sparse https://github.com/OpenAtomFoundation/linglong.git test_clone
cd test_clone
git sparse-checkout set en guide
cd ..
ls -la test_clone

Length of output: 1308

Comment on lines +25 to +26
# 定义版本和 commit 的映射关系
declare -A dict=(
["1.5.0"]="317ef66813e413adafeae5b01186b34eda514248"
# 添加更多的版本和 commit
)
Copy link

Choose a reason for hiding this comment

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

Consider externalizing the version-commit mapping.

The version-commit mapping is hardcoded in the script. Consider externalizing it to a configuration file or environment variable for easier maintenance.

- run: |
    declare -A dict=(
        ["1.5.0"]="317ef66813e413adafeae5b01186b34eda514248"
        # 添加更多的版本和 commit
    )

@chenchongbiao chenchongbiao force-pushed the 20240708-checkout-old-version branch from 6a0c174 to e61753c Compare July 8, 2024 03:14
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (2)
.github/workflows/pages.yml (2)

30-40: Improve documentation for the checkout process.

Consider adding comments to explain the purpose of each command for better readability and maintainability.

- run: |
    # Define version-commit mapping
    declare -A dict=(
        ["1.5.0"]="317ef66813e413adafeae5b01186b34eda514248"
        # Add more versions and commits
    )
    # Iterate through the dictionary and check out each commit to the corresponding directory
    for version in "${!dict[@]}"; do
        commit="${dict[$version]}"
        # Clone the repository to the specified version's directory
        git clone --single-branch --branch $commit --depth 1 --filter=blob:none --sparse https://github.com/OpenAtomFoundation/linglong $version
        cd $version
        git sparse-checkout set en guide
        cd ..
        # List directory contents to confirm the files were checked out correctly
        ls -la $version
    done

[!TIP]
Codebase Verification

Verify the build process.

The GitHub Actions workflow file is missing essential steps for setting up and running the build process. Ensure that the following steps are included:

  • Add the cache: "yarn" option to the setup-node action.
  • Include yarn install to install dependencies.
  • Include yarn build to complete the build process.

Suggested changes:

  • Add cache: "yarn" under setup-node action.
  • Add a step to run yarn install.
  • Add a step to run yarn build.
Analysis chain

Line range hint 49-60:
Verify the build process.

Ensure that the dependencies are correctly installed and the build process completes successfully.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the build process.

# Test: Check if the dependencies are installed and the build process completes.
yarn install && yarn build

Length of output: 86


Script:

#!/bin/bash
# Check if the GitHub Actions workflow file sets up yarn correctly

# Look for setup-node action and yarn installation
ast-grep --lang yaml --pattern $'- uses: actions/setup-node@v3
  with:
    node-version: $_
    cache: "yarn"' .github/workflows/pages.yml

Length of output: 248


Script:

#!/bin/bash
# Verify if the build process steps are correctly defined in the workflow file

# Look for build steps in the workflow file
ast-grep --lang yaml --pattern $'- name: set release version
  run: |
    rm -rf en guide
    mv tmp/docs/pages/guide .
    mv tmp/docs/pages/en .
- uses: actions/setup-node@v3
  with:
    node-version: $_
    cache: "yarn"
- name: build
  run: yarn build' .github/workflows/pages.yml

Length of output: 394


Script:

#!/bin/bash
# Check if the GitHub Actions workflow file sets up yarn correctly

# Look for setup-node action and yarn installation in the workflow file
grep -A 2 'uses: actions/setup-node@v3' .github/workflows/pages.yml

Length of output: 166


Script:

#!/bin/bash
# Verify if the build process steps are correctly defined in the workflow file

# Look for build steps in the workflow file
grep -A 5 'name: set release version' .github/workflows/pages.yml

Length of output: 289

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6a0c174 and e61753c.

Files selected for processing (1)
  • .github/workflows/pages.yml (1 hunks)
Additional comments not posted (3)
.github/workflows/pages.yml (3)

23-29: Consider externalizing the version-commit mapping.

The version-commit mapping is hardcoded in the script. Consider externalizing it to a configuration file or environment variable for easier maintenance.

- run: |
    declare -A dict=(
        ["1.5.0"]="317ef66813e413adafeae5b01186b34eda514248"
        # 添加更多的版本和 commit
    )

Line range hint 43-48:
Verify the specified commit exists.

Ensure that the specified commit 90f0846d2e9b0ed14e6f51e40c3a25b5de35dd93 exists in the repository and is accessible.


41-42: Verify GITHUB_TOKEN permissions.

Ensure that the GITHUB_TOKEN has the necessary permissions to perform the checkout and clone operations.

@chenchongbiao chenchongbiao force-pushed the 20240708-checkout-old-version branch 2 times, most recently from fcf850c to c541a1c Compare July 8, 2024 03:36
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e61753c and c541a1c.

Files selected for processing (1)
  • .github/workflows/pages.yml (1 hunks)
Additional comments not posted (3)
.github/workflows/pages.yml (3)

22-26: Consider externalizing the version-commit mapping.

The version-commit mapping is hardcoded in the script. Consider externalizing it to a configuration file or environment variable for easier maintenance.

- run: |
    declare -A dict=(
        ["1.5.0"]="317ef66813e413adafeae5b01186b34eda514248"
        # 添加更多的版本和 commit
    )

43-43: LGTM! The use of GITHUB_TOKEN is appropriate.

The environment variable GITHUB_TOKEN is correctly added for authentication purposes.


20-41: Verify the correctness of the script.

Ensure that the script correctly clones the repository, sets up sparse checkouts, and moves files as expected.

@chenchongbiao chenchongbiao force-pushed the 20240708-checkout-old-version branch from c541a1c to e6511e4 Compare July 8, 2024 05:09
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c541a1c and e6511e4.

Files selected for processing (1)
  • .github/workflows/pages.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pages.yml

@chenchongbiao chenchongbiao force-pushed the 20240708-checkout-old-version branch from e6511e4 to ff2190c Compare July 8, 2024 05:33
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e6511e4 and ff2190c.

Files selected for processing (1)
  • .github/workflows/pages.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pages.yml

@chenchongbiao chenchongbiao force-pushed the 20240708-checkout-old-version branch from ff2190c to f99fdcd Compare July 8, 2024 05:54
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ff2190c and f99fdcd.

Files selected for processing (1)
  • .github/workflows/pages.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pages.yml

@chenchongbiao chenchongbiao force-pushed the 20240708-checkout-old-version branch from f99fdcd to cdfcec2 Compare July 8, 2024 05:57
更新工作流切出旧版本的文档。

Log: update docs
@chenchongbiao chenchongbiao force-pushed the 20240708-checkout-old-version branch from cdfcec2 to 7393375 Compare July 8, 2024 06:02
@myml myml merged commit 21f8671 into OpenAtom-Linyaps:master Jul 8, 2024
2 checks passed
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chenchongbiao, myml

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants