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

fix: rename the Attempts field to Attempt; expose in gh run view and gh run ls #8905

Merged
merged 3 commits into from May 22, 2024

Conversation

cawfeecake
Copy link
Contributor

@cawfeecake cawfeecake commented Apr 1, 2024

Fixes #9099

@cawfeecake cawfeecake requested a review from a team as a code owner April 1, 2024 20:45
@cawfeecake cawfeecake requested review from andyfeller and removed request for a team April 1, 2024 20:45
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Apr 1, 2024
@cliAutomation
Copy link
Collaborator

Hi! Thanks for the pull request. Please ensure that this change is linked to an issue by mentioning an issue number in the description of the pull request. If this pull request would close the issue, please put the word 'Fixes' before the issue number somewhere in the pull request body. If this is a tiny change like fixing a typo, feel free to ignore this message.

@cliAutomation cliAutomation added this to Needs review 🤔 in The GitHub CLI Apr 1, 2024
@andyfeller
Copy link
Contributor

@cawfeecake : While we appreciate contributors improving the GitHub CLI, could you create an issue that we might discuss this need outside of the PR?

@@ -97,7 +98,7 @@ type Run struct {
workflowName string // cache column
WorkflowID int64 `json:"workflow_id"`
Number int64 `json:"run_number"`
Attempts uint64 `json:"run_attempt"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm genuinely surprised there is no other code that uses this field since it was added in #5945 🤯

That said, how should test cases within the following be updated to ensure this is being exported?

func TestRunExportData(t *testing.T) {

Copy link
Member

Choose a reason for hiding this comment

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

I'm genuinely surprised there is no other code that uses this field since it was added in #5945 🤯

I also went down this rabbit hole like gahhh. It's funny because it was even updated to use uint64 instead of 8 bits because it was causing an unmarshal error even tho it was never useeeeeed.

@williammartin
Copy link
Member

@cawfeecake please create an issue that describes your use case for this field to help us understand the motivation. It's very useful for us and the rest of the community to see what outcomes people are using the CLI for.

@cawfeecake cawfeecake changed the title fix: expose run_attempt field (as attempt) when getting a workflow run fix: rename the Attempts field to Attempt; expose in gh run view and gh run ls May 20, 2024
@cawfeecake
Copy link
Contributor Author

cawfeecake commented May 20, 2024

apologies for the delay. created issue and updated the PR info to align

Copy link
Member

@williammartin williammartin left a comment

Choose a reason for hiding this comment

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

Before

➜ gh run ls --json attempt
Unknown JSON field: "attempt"
Available fields:
  conclusion
  createdAt
  databaseId
  displayTitle
  event
  headBranch
  headSha
  name
  number
  startedAt
  status
  updatedAt
  url
  workflowDatabaseId
  workflowName

After

➜ ./bin/gh run ls --json attempt | cat
[{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1},{"attempt":1}]

I added a test as well, though it only covers ExportData working correctly, and not that you can actually pass this field to gh run ls or gh run view.

@williammartin williammartin merged commit 105bafd into cli:trunk May 22, 2024
9 checks passed
@williammartin
Copy link
Member

Thanks for your work here @cawfeecake !

@cawfeecake cawfeecake deleted the expose-attempt branch May 22, 2024 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external pull request originating outside of the CLI core team
Projects
No open projects
The GitHub CLI
  
Needs review 🤔
Development

Successfully merging this pull request may close these issues.

gh run view, gh run ls don't expose information about which attempt of the run it is
4 participants