metadata:
  name: githubCommentIssue
  description: Comment on GitHub issues and pull requests.
  longDescription: |
    This step allows you to add comments to existing GitHub issues or pull requests.

    Pull requests are considered similar to issues and thus adding a comment can be done to an existing pull request as well.
    This comes in very handy when you want to make developers aware of certain things during a PR voting process, for example.
spec:
  inputs:
    secrets:
      - name: githubTokenCredentialsId
        description: Jenkins 'Secret text' credentials ID containing token to authenticate to GitHub.
        type: jenkins
    params:
      - name: apiUrl
        aliases:
          - name: githubApiUrl
        description: Set the GitHub API url.
        scope:
          - GENERAL
          - PARAMETERS
          - STAGES
          - STEPS
        type: string
        default: https://api.github.com
        mandatory: true
      - name: body
        description: Defines the content of the comment, e.g. using markdown syntax.
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        type: string
        mandatory: true
      - name: number
        description: Defines the number of the GitHub issue/pull request.
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        type: int
        mandatory: true
      - name: owner
        aliases:
          - name: githubOrg
        description: Name of the GitHub organization.
        resourceRef:
          - name: commonPipelineEnvironment
            param: github/owner
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        type: string
        mandatory: true
      - name: repository
        aliases:
          - name: githubRepo
        description: Name of the GitHub repository.
        resourceRef:
          - name: commonPipelineEnvironment
            param: github/repository
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        type: string
        mandatory: true
      - name: token
        aliases:
          - name: githubToken
          - name: access_token
        description: GitHub personal access token as per https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line.
        scope:
          - GENERAL
          - PARAMETERS
          - STAGES
          - STEPS
        type: string
        mandatory: true
        secret: true
        resourceRef:
          - name: githubTokenCredentialsId
            type: secret
          - type: vaultSecret
            default: github
            name: githubVaultSecretName
