1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-24 06:15:46 +00:00
catalog/task/github-request-reviewers/0.1/README.md
Quan Zhang e294e1246b [TEP-0110] Update Tekton Catalog installation instructions
Prior to this change, the installation instructions directly use the resource urls in the Catalog repo, which results in tight coupling between the organization and how users fetch resources (as described in TEP-0110). This commit updates the installation guide to install Tekton Catalog resources via Tekton Hub Api: https://github.com/tektoncd/hub/pull/539

This change decouples the Tekton Catalog organization from resouces resolution, which enables Tekton Catalog reorganization.
2022-08-16 16:25:52 +01:00

2.6 KiB

Request reviewers on a pull request

The github-request-reviewers task lets one request reviewers on a pull request. It implements the corresponding GitHub API to request reviewers.

Changelog

  • v0.1: Initial version.

Install the Task

kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/github-request-reviewers/0.1/raw

Secrets

This Task requires access to a GitHub token. The token is expected to be in a workspace, which will typically be bound to Kubernetes Secret at run time. The name of the file in the workspace is token by default, but it can be configured via the github-token-key parameter from the parameters described below.

To create such a Secret via kubectl:

kubectl create secret generic github --from-literal token="MY_TOKEN"

Check this to get personal access token for Github.

Requesting reviewers only requires the public_repo scope for the token. See GitHub's documentation on Understanding scopes for OAuth Apps for more details.

Parameters

  • GITHUB_HOST_URL:: The GitHub host domain (default: api.github.com)
  • API_PATH_PREFIX:: The GitHub Enterprise has a prefix for the API path. e.g: /api/v3 (default: "").
  • PACKAGE:: The GitHub {org}/{repo}, e.g: tektoncd/catalog
  • PULL_REQUEST_NUMBER:: The GitHub pull request or issue url, e.g: 1234
  • REVIEWERS:: Comma separated list of github user slugs e.g: user1,user2 (default: "").
  • TEAM_REVIEWERS: Comma separated list of github user slugs (default: "").
  • GITHUB_TOKEN_FILE: The name of the file in the workspace that contains the github token. (default: token).

Workspaces

  • github: The workspace that contains the github token

Platforms

The Task can be run on linux/amd64, linux/s390x and linux/ppc64le platforms.

Usage

This TaskRun requests both users and teams as reviewers:

---
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  generateName: github-request-reviewers-
spec:
  taskRef:
    kind: Task
    name: github-request-reviewers
  workspace:
    - name: github
      secret:
        secretName: "bot-token-github"
  params:
    - name: PACKAGE
      value: tektoncd/catalog
    - name: PULL_REQUEST_NUMBER
      value: "1234"
    - name: REVIEWERS
      value: "user1,user2"
    - name: TEAM_REVIEWERS
      value: "team1,team2"