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
Vincent Demeester d93795673c Update self reference from master to main 🧙
And update references to community, pipeline, etc. too.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
2021-03-19 11:09:49 +00:00
..
samples Modifies directory names based on the proposal 2020-07-14 19:01:58 +01:00
github-add-labels.yaml Fix typo 2020-11-19 09:20:28 +00:00
README.md Update self reference from master to main 🧙 2021-03-19 11:09:49 +00: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/main/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.