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

feat: enable archival of repos #301

Merged
merged 1 commit into from
Dec 31, 2024
Merged

feat: enable archival of repos #301

merged 1 commit into from
Dec 31, 2024

Conversation

ramirezj
Copy link
Member

@ramirezj ramirezj commented Dec 31, 2024

Summary by CodeRabbit

  • New Features

    • Added support for archiving GitHub repositories
    • Introduced configuration option to mark repositories as archived
  • Updates

    • Updated "gatsby-baseline" and "remix-baseline" repositories to be archived by default
  • Configuration

    • New boolean variable archived added to control repository archival status
    • Default archival state set to false

Signed-off-by: James Ramirez <james.ramirez@grendel-consulting.com>
Copy link

coderabbitai bot commented Dec 31, 2024

Walkthrough

This pull request introduces an archived attribute to the GitHub repository module, enabling the archiving of specific repositories. The changes span multiple files, adding a new boolean variable to control repository archiving status, updating the repository resource to support this attribute, and modifying the main configuration to incorporate the archiving option for selected repositories.

Changes

File Change Summary
main.tf Added archived attribute to "repositories" module using lookup function with default null
modules/repository/repository.tf Introduced archived attribute to github_repository resource, set via var.archived
modules/repository/variables.tf Created new archived variable of type bool, default false, with description "Whether or not to archive the GitHub repo"
variables.tf Updated locals block for "gatsby-baseline" and "remix-baseline" repositories, adding archived: true

Possibly related PRs


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>, 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. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

Copy link

Terraform Cloud Plan Output

Plan: 0 to add, 2 to change, 0 to destroy.
Terraform Cloud Plan

@ramirezj
Copy link
Member Author

@coderabbitai review

Copy link

coderabbitai bot commented Dec 31, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

🧹 Nitpick comments (1)
modules/repository/repository.tf (1)

7-7: Implementation is correct, consider archival implications.

The archived attribute is properly implemented. However, be aware that archiving a repository:

  • Makes it read-only
  • Disables many features including issues, pull requests, and discussions
  • Cannot be unarchived through Terraform (requires manual GitHub intervention)

Consider implementing a pre-archive checklist in your workflow to:

  1. Document the archival process
  2. Ensure important discussions and issues are properly resolved
  3. Update any external references to the repository
  4. Plan for potential future unarchiving needs
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dc7d18d and 864a00f.

📒 Files selected for processing (4)
  • main.tf (1 hunks)
  • modules/repository/repository.tf (1 hunks)
  • modules/repository/variables.tf (1 hunks)
  • variables.tf (1 hunks)
🔇 Additional comments (5)
main.tf (1)

16-16: Implementation looks sound!

The archived attribute implementation follows HashiCorp's recommended pattern for optional module attributes. Using null as the default value allows for proper fallback to the variable's default in the repository module.

Let's verify the repository configurations:

✅ Verification successful

Implementation verified and working as expected

The verification confirms that:

  • The archived variable in the repository module has a default value of false
  • Two repositories are configured to be archived in the locals block:
    • gatsby-baseline
    • remix-baseline
  • The implementation properly passes the archived status from the root module to the repository module

The usage of lookup(each.value, "archived", null) is correct as it allows repositories to:

  • Be explicitly archived when archived: true is set
  • Use the module's default value (false) when not specified
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for repositories marked for archival
# Expected: Find any .tf files containing archived = true configurations

rg -l 'archived\s*=\s*true' --type tf

Length of output: 39


Script:

#!/bin/bash
# Let's check the repository module's variables.tf to understand the default value for archived
fd "variables.tf" --exec cat {} \;

# Also check if there are any repository configurations with archived set to any value
rg "archived\s*=" --type tf -A 2 -B 2

Length of output: 4581

modules/repository/variables.tf (1)

41-45: Variable declaration is well-structured!

The archived variable follows best practices with:

  • Appropriate boolean type
  • Sensible default value (false)
  • Clear description

Let's verify no conflicting variable declarations exist:

✅ Verification successful

No duplicate variable declarations found

The archived variable is only declared once in modules/repository/variables.tf, confirming there are no conflicting declarations in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any duplicate archived variable declarations
# Expected: Only one declaration should exist

rg -l 'variable\s+"archived"\s+{' --type tf

Length of output: 159


Script:

#!/bin/bash
# Description: Check for any duplicate archived variable declarations
# Expected: Only one declaration should exist

rg -l 'variable "archived"' --type tf

Length of output: 71

variables.tf (3)

20-22: Implementation looks sound

The archival flags are correctly implemented within the repository configuration structure. The changes maintain consistent formatting and follow the established pattern for repository definitions.


22-22: Ensure remix-baseline archival impact is documented

Before archiving, please:

  1. Document the rationale for archival in the repository README
  2. Update any organisation documentation that references this baseline
  3. Consider adding a notice about recommended alternatives

Let's verify the repository's current state and usage:

✅ Verification successful

Let me try another search strategy to gather more information about the repository usage.


Repository archival confirmed - documentation updates recommended

The repository remix-baseline is already archived according to the GitHub API response, and our searches show minimal integration across the organisation. However, proper documentation of this archival decision is still important for future reference.

Please ensure:

  • Add a section to the repository's README explaining why it was archived
  • Document any recommended alternatives for teams looking to start new Remix projects
  • Update the repository description to indicate its archived status
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for references to remix-baseline across the organisation
rg -i "remix-baseline" --type yaml --type typescript --type javascript

# Check repository status and dependents
gh api graphql -f query='
{
  repository(owner: "grendel-consulting", name: "remix-baseline") {
    dependencyGraphManifests(first: 10) {
      nodes {
        dependencies(first: 10) {
          nodes {
            repository {
              nameWithOwner
            }
          }
        }
      }
    }
    isArchived
  }
}'

Length of output: 520


Script:

#!/bin/bash
# Check for references to remix-baseline in markdown files and package.json
rg -i "remix-baseline" --type md --type json

# Check if there's a README in the repository
fd "README.md" --type f --exec cat {}

Length of output: 276


20-20: Please verify that gatsby-baseline is ready for archival

Before proceeding with archival, ensure that:

  1. No active projects depend on this baseline
  2. Documentation is updated to reflect the archived status
  3. A clear migration path exists for existing users

Let's check for repository dependencies and recent activity:

✅ Verification successful

Let me gather more information about potential dependencies and usage:


Archival of gatsby-baseline repository appears appropriate

Based on the verification results:

  • The repository is already marked as archived on GitHub
  • Recent commits show intentional preparation for archival ("chore: prepare to archive repo")
  • No open pull requests exist
  • No direct references found in JSON or Markdown files across the codebase
  • Only one fork exists, which can continue independently

The archival status in variables.tf aligns with the repository's current state and recent administrative actions. The change appears to be part of a coordinated archival process.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for references to gatsby-baseline across the organisation
rg -i "gatsby-baseline" --type yaml --type typescript --type javascript

# Check for forks that might be affected
gh api graphql -f query='
{
  repository(owner: "grendel-consulting", name: "gatsby-baseline") {
    forks {
      totalCount
    }
    updatedAt
    isArchived
  }
}'

Length of output: 380


Script:

#!/bin/bash
# Search for references to gatsby-baseline in package.json files and other potential dependency files
rg -i "gatsby-baseline" --type json --type markdown

# Check for any recent commits or PRs
gh api graphql -f query='
{
  repository(owner: "grendel-consulting", name: "gatsby-baseline") {
    defaultBranchRef {
      target {
        ... on Commit {
          history(first: 5) {
            nodes {
              committedDate
              messageHeadline
            }
          }
        }
      }
    }
    pullRequests(last: 5, states: [OPEN]) {
      nodes {
        title
        updatedAt
      }
    }
  }
}'

Length of output: 1196

@ramirezj ramirezj merged commit 27ab99d into main Dec 31, 2024
9 checks passed
@ramirezj ramirezj deleted the archiving branch December 31, 2024 11:49
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.

1 participant