Giter Club home page Giter Club logo

gh-report's Introduction

gh-report's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar octoherd-stoe[bot] avatar stoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gh-report's Issues

Default billing report errors on non-enterprise organizations

Describe the bug

The reproduction sort of describes the error succinctly. I have admin:org on my token (playing with a different extension and I haven’t lowered the privileges yet), but we are on the Team plan. Running gh report billing --owner FOO without explicitly excluding the Advanced Security report results in code termination with an HTTP 403 (advanced security cannot be enabled on the team plan).

To Reproduce

Steps to reproduce the behavior:

$ gh report billing --owner TeamName
⠇ fetching KineticCommerce billing report (security data)Error: HTTP 403: repository not enabled for code scanning (https://api.github.com/orgs/KineticCommerce/settings/billing/advanced-security)
Usage:
  report billing [flags]

Flags:
      --actions    Get GitHub Actions billing
      --all        Get all billing data (default true)
  -h, --help       help for billing
      --packages   Get GitHub Packages billing
      --security   Get GitHub Advanced Security active committers
      --storage    Get shared storage billing

Global Flags:
      --csv string                   Path to CSV file, to save report to file
  -e, --enterprise read:enterprise   GitHub Enterprise Cloud account (requires read:enterprise scope)
      --hostname string              GitHub Enterprise Server hostname (default "github.com")
      --json string                  Path to JSON file, to save report to file
      --md string                    Path to MD file, to save report to file
      --no-cache                     Do not cache results for one hour (default "false")
  -o, --owner read:org               GitHub account organization (requires read:org scope) or user account (requires `n/a` scope)
  -r, --repo repo                    GitHub repository (owner/repo), requires repo scope
      --silent                       Do not print any output (default: "false")
  -t, --token string                 GitHub Personal Access Token (default "gh auth token")

HTTP 403: repository not enabled for code scanning (https://api.github.com/orgs/KineticCommerce/settings/billing/advanced-security)

Expected behavior

I would expect to see the report without having to specify --packages --storage --actions.

  1. The best solution would be if the billing report can see the plan and implicitly disable the security report unless (a) on the enterprise plan or (b) --security is passed explicitly.
  2. The next best solution would be to disable a report, such as --security=false or --no-security.

Environment

  • Go version 1.20.3
  • Shell Type: fish
  • Terminal: iTerm

Additional context

Add any other context about the problem here.

Support darwin-arm64

Describe the bug

darwin-arm64 is not supported.

To Reproduce

  1. gh extension upgrade stoe/gh-report
  2. gh-report unsupported for darwin-arm64.

Expected behavior

darwin-arm64 is supported.

Environment

(please complete the following information)

  • Go version 1.20
  • Shell Type: zsh
  • Terminal: native

Support darwin-arm64

Is your feature request related to a problem? Please describe.

$ gh extension install stoe/gh-report
gh-report unsupported for darwin-arm64.

Describe the solution you'd like

Support darwin-arm64

Describe alternatives you've considered

n/a

Additional context

n/a

Fix Billing `Int` vs `Float`

Describe the bug

$ gh report billing --token "${GH_PAT}" -e stoelzle
⠋Error: json: cannot unmarshal number 50000.0 into Go struct field ActionsBilling.included_minutes of type int
Usage:
  gh-report billing [flags]

Flags:
      --actions    Get GitHub Actions billing
      --all        Get all billing data (default true)
  -h, --help       help for billing
      --packages   Get GitHub Packages billing
      --security   Get GitHub Advanced Security active committers
      --storage    Get shared storage billing

Global Flags:
      --csv string          Path to CSV file
  -e, --enterprise string   GitHub Enterprise Cloud account
      --hostname string     GitHub Enterprise Server hostname
      --json string         Path to JSON file
      --no-cache            do not cache results for one hour (default: false)
  -o, --owner string        GitHub account (organization or user account)
  -r, --repo string         GitHub repository (owner/repo)
      --silent              do not print any output (default: false)
      --token string        GitHub Personal Access Token (default: "")

json: cannot unmarshal number 50000.0 into Go struct field ActionsBilling.included_minutes of type int

Add support for secure token storage

Token storage change in latest release of gh

This is a message from the GitHub CLI team, maintainers of gh, writing to inform you that the most recent release of gh contains changes which may affect your extension. The latest release introduces the feature of storing authentication tokens in the system keyring (encrypted storage) instead of in a plain text file.
The keyrings that are supported are:

  • Keychain on macOS

  • GNOME Keyring on Linux (Secret Service dbus interface)

  • Wincred on Windows

This has huge security benefits for the users of our tool and was one of our oldest outstanding issues. Unfortunately this change has the potential to break extensions that rely on utilizing the users authentication token to work.

In order to have continued compatibility with gh there are some actions you, as an extension author, need to take. These actions will depend on the implementation of your extension.

Extensions built in Go using go-gh:

  1. Upgrade your go-gh version to v1.2.1, the latest version.

  2. Verify that in your extension retrieval of the user authentication token is done using the auth.TokenForHost function.

    • If you were previously accessing the authentication token using any other method it will no longer work.
    • Automatic resolution of the authentication token when using the API clients will continue to work without changes.

All other extensions:

  1. Verify that in your extension retrieval of the user authentication token is done by shelling out to the gh auth token command.

    • If you were previously accessing the authentication token using the gh config get command, reading the configuration file directly, or any other methods it will no longer work.

As of right now storing the authentication token in the system keyring is an opt-in feature, but in the near future it will be required and at that point if the changes above are not made then your extension will be broken for all users. If you have any questions/concerns about this change please feel free to open a discussion in the gh repo.

Thanks,
The GitHub CLI Team

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.