Skip to content

The ability to retrieve a repo's archived timestamp. #9746

Closed

Description

@norman-abramovitz

Describe the feature or problem you’d like to solve

Our technical oversight committee (TOC) would like to better identify, notify and make requests to our user community when one of our third party artifacts has been archived by its maintainer. An artifact is tied to a repo. Knowing that an artifact has been archived is insufficient since it does not mean the artifact is useless The user community should know when it was archived so they can make their own decision if some other person wants to start maintaining the artifact for the general community, stop using the artifact or make their own fork for the artifact. The TOC also want to display and sort by the archive timestamp when displaying the various artifacts on web pages.

As an artifact ages, the TOC can make requests to the community if they believe the artifact should continue being maintained or even dropped.

The GH command has most of of the information we need to automate this process, but it was missing the archived timestamp.

Proposed solution

When you go to the home page of an archived repo, the date is displayed when the repo was archived. We would like to retrieve that same date through the GH command. The same useful information displayed on the repo's main page would also be available through the GH command.

Currently we can retrieve the archive status using the json variable isArchived.

gh repo view --json isArchived <repo>

The proposed solution would be to add a new variable for the archive timestamp.

gh repo view --json isArchived,archivedAt <repo>

Activity

  1. williammartin commented on Oct 11, 2024

    @williammartin
    Member

    @andyfeller just FYI I already semi-triaged this here: #9744 (comment)

  2. added a commit that references this issue on Oct 11, 2024
  3. added
    gh-reporelating to the gh repo command
    and removed on Oct 16, 2024
  4. andyfeller commented on Oct 16, 2024

    @andyfeller
    Contributor

    Thanks, @williammartin! 🙇

    @norman-abramovitz : If this is something you might be interested doing, it should be primarily:

    1. adding the missing ArchivedAt field to the Repository
    2. adding the new ArchivedAt field to the list of fields exported
    3. update the related tests

    cli/api/queries_repo.go

    Lines 27 to 133 in 7aef6ec

    // Repository contains information about a GitHub repo
    type Repository struct {
    ID string
    Name string
    NameWithOwner string
    Owner RepositoryOwner
    Parent *Repository
    TemplateRepository *Repository
    Description string
    HomepageURL string
    OpenGraphImageURL string
    UsesCustomOpenGraphImage bool
    URL string
    SSHURL string
    MirrorURL string
    SecurityPolicyURL string
    CreatedAt time.Time
    PushedAt *time.Time
    UpdatedAt time.Time
    IsBlankIssuesEnabled bool
    IsSecurityPolicyEnabled bool
    HasIssuesEnabled bool
    HasProjectsEnabled bool
    HasDiscussionsEnabled bool
    HasWikiEnabled bool
    MergeCommitAllowed bool
    SquashMergeAllowed bool
    RebaseMergeAllowed bool
    AutoMergeAllowed bool
    ForkCount int
    StargazerCount int
    Watchers struct {
    TotalCount int `json:"totalCount"`
    }
    Issues struct {
    TotalCount int `json:"totalCount"`
    }
    PullRequests struct {
    TotalCount int `json:"totalCount"`
    }
    CodeOfConduct *CodeOfConduct
    ContactLinks []ContactLink
    DefaultBranchRef BranchRef
    DeleteBranchOnMerge bool
    DiskUsage int
    FundingLinks []FundingLink
    IsArchived bool
    IsEmpty bool
    IsFork bool
    ForkingAllowed bool
    IsInOrganization bool
    IsMirror bool
    IsPrivate bool
    IsTemplate bool
    IsUserConfigurationRepository bool
    LicenseInfo *RepositoryLicense
    ViewerCanAdminister bool
    ViewerDefaultCommitEmail string
    ViewerDefaultMergeMethod string
    ViewerHasStarred bool
    ViewerPermission string
    ViewerPossibleCommitEmails []string
    ViewerSubscription string
    Visibility string
    RepositoryTopics struct {
    Nodes []struct {
    Topic RepositoryTopic
    }
    }
    PrimaryLanguage *CodingLanguage
    Languages struct {
    Edges []struct {
    Size int `json:"size"`
    Node CodingLanguage `json:"node"`
    }
    }
    IssueTemplates []IssueTemplate
    PullRequestTemplates []PullRequestTemplate
    Labels struct {
    Nodes []IssueLabel
    }
    Milestones struct {
    Nodes []Milestone
    }
    LatestRelease *RepositoryRelease
    AssignableUsers struct {
    Nodes []GitHubUser
    }
    MentionableUsers struct {
    Nodes []GitHubUser
    }
    Projects struct {
    Nodes []RepoProject
    }
    ProjectsV2 struct {
    Nodes []ProjectV2
    }
    // pseudo-field that keeps track of host name of this repo
    hostname string
    }

    cli/api/query_builder.go

    Lines 384 to 426 in 7aef6ec

    var RepositoryFields = []string{
    "id",
    "name",
    "nameWithOwner",
    "owner",
    "parent",
    "templateRepository",
    "description",
    "homepageUrl",
    "openGraphImageUrl",
    "usesCustomOpenGraphImage",
    "url",
    "sshUrl",
    "mirrorUrl",
    "securityPolicyUrl",
    "createdAt",
    "pushedAt",
    "updatedAt",
    "isBlankIssuesEnabled",
    "isSecurityPolicyEnabled",
    "hasIssuesEnabled",
    "hasProjectsEnabled",
    "hasWikiEnabled",
    "hasDiscussionsEnabled",
    "mergeCommitAllowed",
    "squashMergeAllowed",
    "rebaseMergeAllowed",
    "forkCount",
    "stargazerCount",
    "watchers",
    "issues",
    "pullRequests",
    "codeOfConduct",
    "contactLinks",
    "defaultBranchRef",
    "deleteBranchOnMerge",
    "diskUsage",
    "fundingLinks",
    "isArchived",

  5. norman-abramovitz commented on Oct 16, 2024

    @norman-abramovitz
    Author

    Sure, I will have to give @williammartin most of the credit though.

    Testcases

    1. Display archive timestamp on active repo
    2. Display archive timestamp on archived repo
  6. tsukasaI commented on Oct 18, 2024

    @tsukasaI
    Contributor

    Hi there.
    Can I take this issue?

  7. williammartin commented on Oct 18, 2024

    @williammartin
    Member

    Sure thing, thanks! We don't officially assign issues to OSS contributors but please go ahead and open a PR.

  8. tsukasaI commented on Oct 19, 2024

    @tsukasaI
    Contributor

    Hi.

    I've opened the PR.

    #9790

    I would like to make sure especially which test file I should update.

    Have a look when you have time, thanks.

  9. assigned and unassigned on Oct 21, 2024
  10. williammartin commented on Oct 22, 2024

    @williammartin
    Member

    Acceptance Criteria

    Given I have an archived repo
    When I run gh repo view --json archivedAt <repo>
    Then I see the archived date of the repo in the json response is populated

    Given I have an unarchived repo
    When I run gh repo view --json archivedAt <repo>
    Then I see the archived date of the repo is null

    Given I have archived and unarchived repos
    When I run gh repo list --json name,archivedAt <repo>
    Then I see the archived dates of the repos populated or null as expected

  11. williammartin commented on Oct 22, 2024

    @williammartin
    Member

    Delivered in #9790, should make it out in a release this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-reporelating to the gh repo commandhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions