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: add DeNA/unity-meta-check/unity-meta-check-github-pr-comment #22863

Conversation

ponkio-o
Copy link
Sponsor Contributor

@ponkio-o ponkio-o commented May 14, 2024

DeNA/unity-meta-check/unity-meta-check-github-pr-comment: Reporter for GitHub comments of GitHub issues or pull requests. It need a result of unity-meta-check from stdin.

Check List

How to confirm if this package works well

Reviewers aren't necessarily familiar with this package, so please describe how to confirm if this package works well.
Please confirm if this package works well yourself as much as possible.

Command and output

root@927907d6c78d:/workspace# unity-meta-check-github-pr-comment --help
usage: unity-meta-check-github-pr-comment [<options>]

Post a comment for the result from unity-meta-check via STDIN to GitHub Pull Request.

OPTIONS
  -api-endpoint string
        GitHub API endpoint URL (like https://api.github.com or https://github.example.com/api/v3) (default "https://api.github.com")
  -debug
        set log level to DEBUG (default INFO)
  -lang string
        language code (available: en, ja) (default "en")
  -no-send-success
        do not send a comment if no missing/dangling .meta found
  -owner string
        owner of the GitHub repository
  -pull int
        pull request number
  -repo string
        name of the GitHub repository
  -silent
        set log level to WARN (default INFO)
  -template-file string
        custom template file
  -version
        print version

ENVIRONMENT
  GITHUB_TOKEN
        GitHub API token. The scope can be empty if your repository is public. Otherwise, the scope should contain "repo"

EXAMPLE USAGES
  $ export GITHUB_TOKEN="********"
  $ unity-meta-check <options> | unity-meta-check-github-pr-comment \
      -api-endpoint https://api.github.com \
      -owner example-org \
      -repo my-repo \
      -pull "$CIRCLE_PR_NUMBER"  # This is for CircleCI

  $ export GITHUB_TOKEN="********"  # This should be set via credentials().
  $ unity-meta-check <options> | unity-meta-check-github-pr-comment \
      -api-endpoint https://github.example.com/api/v3 \
      -owner example-org \
      -repo my-repo \
      -pull "$ghprbPullId"  # This is for Jenkins with GitHub PullRequest Builder plugin

  $ GITHUB_TOKEN="********" unity-meta-check <options> | unity-meta-check-junit path/to/unity-meta-check-result.xml | unity-meta-check-github-pr-comment <options> | <other-unity-meta-check-tool>

  $ export GITHUB_TOKEN="********"  # This should be set via credentials().
  $ unity-meta-check <options> | unity-meta-check-github-pr-comment \
      -api-endpoint https://github.example.com/api/v3 \
      -owner example-org \
      -repo my-repo \
      -pull "$ghprbPullId" \
      -template-file path/to/template.json  # template file can be used for localization for GitHub comments.

TEMPLATE FILE FORMAT EXAMPLE
  If a template file is like:

  {
    "success": "No missing/dangling .meta found. Perfect!",
    "failure": "Some missing or dangling .meta found. Fix commits are needed.",
    "header_status": "Status",
    "header_file_path": "File",
    "status_missing": "Not committed",
    "status_dangling": "Not removed"
  }

  then the output become:

  No missing/dangling .meta found. Perfect!

  or:

  Some missing or dangling .meta found. Fix commits are needed.

  | Status | File |
  |:--|:--|
  | Not committed | `path/to/missing.meta` |
  | Not removed | `path/to/dangling.meta` |

If files such as configuration file are needed, please share them.

Reference

ponkio-o and others added 4 commits April 24, 2024 11:01
[DeNA/unity-meta-check/unity-meta-check-github-pr-comment](https://github.com/DeNA/unity-meta-check): Reporter for GitHub comments of GitHub issues or pull requests. It need a result of unity-meta-check from stdin.
@suzuki-shunsuke
Copy link
Member

Thank you!

@suzuki-shunsuke
Copy link
Member

Same with #22862 (review)

@ponkio-o
Copy link
Sponsor Contributor Author

Sorry. I did not understand such a policy and will correct everything PRs.

@suzuki-shunsuke
Copy link
Member

Sorry. I did not understand such a policy and will correct everything PRs.

I'm sorry I didn't explain about this.
I should write the document about it in the style guide. https://aquaproj.github.io/docs/develop-registry/registry-style-guide
I didn't write the document because it's hard to explain this in English to me. 😅

@suzuki-shunsuke
Copy link
Member

BTW, all pull requests would conflict everytime these pull requests are merged because these package names are consecutive.
In that case, I always resolve the conflict by the following way.

  1. Copy registry.yaml to registry.yaml.bak in advance
cp registry.yaml registry.yaml.bak
  1. Checkout the pull request branch
gh pr checkout 22863
  1. Merge main branch, then conflict would occur
git fetch origin main
git merge origin/main
  1. Copy registry.yaml.bak to registry.yaml
cp registry.yaml.bak registry.yaml
  1. Run cmdx gr, then conflict would be resolved
cmdx gr
  1. Create a commit and push it to the remote branch

@suzuki-shunsuke suzuki-shunsuke merged commit ab27e3a into aquaproj:main May 14, 2024
16 checks passed
@ponkio-o ponkio-o deleted the feat/DeNA/unity-meta-check/unity-meta-check-github-pr-comment branch May 14, 2024 10:38
@suzuki-shunsuke suzuki-shunsuke added the enhancement New feature or request label May 14, 2024
@suzuki-shunsuke suzuki-shunsuke added this to the v4.179.1 milestone May 14, 2024
@suzuki-shunsuke
Copy link
Member

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

Successfully merging this pull request may close these issues.

None yet

2 participants