1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-22 06:02:51 +00:00
catalog/task/github-add-labels/0.1
PuneetPunamiya ccd1080419 Modifies the path in readme for samples directory
Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>
2020-07-15 02:43:58 +01:00
..
samples Modifies directory names based on the proposal 2020-07-14 19:01:58 +01:00
github-add-labels.yaml This patch splits github-add-labels task from the github directory 2020-07-13 13:41:58 +01:00
README.md Modifies the path in readme for samples directory 2020-07-15 02:43:58 +01:00

Add labels to an issue or a pull request

This task can be used to add labels to a github pull request or an issue.

Install the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/github-add-labels/0.1/github-add-labels.yaml

Parameters

  • GITHUB_HOST_URL: The GitHub host, adjust this if you run a GitHub enteprise (default:api.github.com).
  • API_PATH_PREFIX: The API path prefix, GitHub Enterprise has a prefix (e.g.:api/v3 default:"").
  • REQUEST_URL: The GitHub issue or pull request URL where we want to add labels (e.g.https://github.com/foo/bar/pull/10).
  • LABELS: The actual labels to add. Multiple labels can be added in the form of array.
  • GITHUB_TOKEN_SECRET: The name of the secret holding the github-token (default:github).
  • GITHUB_TOKEN_SECRET_KEY: The name of the secret key holding the github-token (default:token).

Secret

  • Secret to provide Github access token to authenticate to the Github.

Check this to get personal access token for Github.

Usage

This task expects a secret named github to exists, with a GitHub token in token with enough privileges to add label to a pull request or an issue.

To add labels to a pull request or an issue, put all the required params, add required secrets and labels will be added to respective pull request or an issue.

Secrets can be created as follows:

apiVersion: v1
kind: Secret
metadata:
  name: github
type: Opaque
stringData:
  token: $(personal_github_token)

or

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

Multiple labels can be added in Taskrun as follows:

params:
    - name: REQUEST_URL
      value: https://github.com/Divyansh42/aws-cli/pull/1
    - name: LABELS
      value:
        - approve
        - kind/feature

This can be referred to create a Taskrun.