← 全部工具

suzuki-shunsuke/ci-info

热度 75 更新于 开发与构建

CLI tool to get CI related information

githubauto-collected

安装

暂未验证可直接使用的安装命令,请查看项目官方文档或 Release。

ci-info

CLI tool to get CI related information.

Motivation

We develop this tool to get some information in CI.

  • Related Pull Request
  • PR Author
  • Pull Request Files
  • Labels
  • base and head branch
  • etc
  • etc

Requirements

GitHub Access Token with the pull requests read permission is required to get the information about the Pull Request. In the public repository, GitHub Access Token is optional.

Getting Started

Run the following command, which gets the information about https://github.com/suzuki-shunsuke/github-comment/pull/132 .

$ ci-info run --owner suzuki-shunsuke --repo github-comment --pr 132
export CI_INFO_IS_PR=true
export CI_INFO_HAS_ASSOCIATED_PR=true
export CI_INFO_PR_NUMBER=132
export CI_INFO_BASE_REF=master
export CI_INFO_HEAD_REF=feat/add-silent-option
export CI_INFO_PR_AUTHOR=suzuki-shunsuke
export CI_INFO_PR_MERGED=true
export CI_INFO_REPO_OWNER=suzuki-shunsuke
export CI_INFO_REPO_NAME=github-comment
export CI_INFO_TEMP_DIR=/var/folders/w0/kzjzgvd52wg5s4jy5h0lcyqh0000gn/T/ci-info497729786

Then the shell script to export the environment variables are outputted and some files are created. You can export them by eval.

eval "$(ci-info run --owner suzuki-shunsuke --repo github-comment --pr 132)"

Some files are created.

ls "$CI_INFO_TEMP_DIR"
  • prfiles.txt: The list of pull request file paths which include a maximum of 3000 files
  • prallfilenames.txt: The list of pull request file paths which include a maximum of 3000 files. In addition to prfiles.txt, the list of renamed file's previousfilename is included too.
  • prfiles.json: The response body of GitHub API List pull requests files
  • pr.json: The response body of GitHub API Get a pull request
  • labels.txt: The list of pull request label names

Note that the created directory and files aren't removed automatically.

Usage