Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
bookmark

GitHub Action

Tracker Validator

v1.2.0

Tracker Validator

bookmark

Tracker Validator

Bugzilla and Jira validation for Pull Requests

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Tracker Validator

uses: redhat-plumbers-in-action/[email protected]

Learn more about this action in redhat-plumbers-in-action/tracker-validator

Choose a version

Tracker Validator

GitHub Marketplace Lint Code Base Unit Tests CodeQL Check dist/

codecov Mergify Status

The purpose of this action is to offer reliable validator Red Hat trackers like Bugzilla and JIRA.

How does it work

TBD

Features

  • product, component and flags validation
  • feedback in form of labels and status check directly on Pull Requests

Usage

name: Gather Pull Request Metadata
on:
  pull_request:
    types: [ opened, reopened, synchronize ]
    branches: [ main ]

permissions:
  contents: read

jobs:
  gather-metadata:
    runs-on: ubuntu-latest

    steps:
      - name: Repository checkout
        uses: actions/checkout@v3

      - id: Metadata
        name: Gather Pull Request Metadata
        uses: redhat-plumbers-in-action/gather-pull-request-metadata@v1

      - name: Upload artifact with gathered metadata
        uses: actions/upload-artifact@v3
        with:
          name: pr-metadata
          path: ${{ steps.Metadata.outputs.metadata-file }}
name: Tracker Validator
on:
  workflow_run:
    workflows: [ Gather Pull Request Metadata ]
    types:
      - completed

permissions:
  contents: read

jobs:
  download-metadata:
    if: >
      github.event.workflow_run.event == 'pull_request' &&
      github.event.workflow_run.conclusion == 'success'
    runs-on: ubuntu-latest

    outputs:
      pr-metadata: ${{ steps.Artifact.outputs.pr-metadata-json }}

    steps:
      - id: Artifact
        name: Download Artifact
        uses: redhat-plumbers-in-action/download-artifact@v1
        with:
          name: pr-metadata

  commit-linter:
    needs: [ download-metadata ]
    runs-on: ubuntu-latest

    outputs:
      validated-pr-metadata: ${{ steps.commit-linter.outputs.validated-pr-metadata }}

    permissions:
      # required for creation of checks
      checks: write
      # required for PR comments and set labels
      pull-requests: write

    steps:
      - id: commit-linter
        name: Lint Commits
        uses: redhat-plumbers-in-action/advanced-commit-linter@v1
        with:
          pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
          token: ${{ secrets.GITHUB_TOKEN }}

  tracker-validator:
    needs: [ download-metadata, commit-linter ]
    runs-on: ubuntu-latest

    outputs:
      validated-pr-metadata: ${{ steps.commit-linter.outputs.validated-pr-metadata }}

    permissions:
      # required for creation of checks
      checks: write
      # required for PR comments and set labels
      pull-requests: write

    steps:
      - name: Get Tracker ID
        run:
          validated-pr-metadata

      - id: tracker-validator
        name: Validate Tracker
        uses: redhat-plumbers-in-action/tracker-validator@v1
        with:
          pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
          product: Red Hat Enterprise Linux 9
          component: systemd
          bugzilla-tracker: 
          bugzilla-instance: https://bugzilla.stage.redhat.com
          bugzilla-api-token: ${{ secrets.BUGZILLA_API_TOKEN }}
          token: ${{ secrets.GITHUB_TOKEN }}

Real-life examples

...

Configuration options

Action currently accepts the following options:

# ...

- uses: redhat-plumbers-in-action/tracker-validator@v1
  with:
    pr-metadata:        <pr-metadata.json>
    config-path:        <path to config file>
    tracker:            <tracker ID>
    tracker-type:       <tracker type>
    product:            <product name>
    component:          <component name>
    bugzilla-instance:  <Bugzilla instance URL>
    bugzilla-api-token: <Bugzilla API token>
    jira-instance:      <Jira instance URL>
    jiira-api-token:    <Jira API token>
    token:              <GitHub token or PAT>

# ...

pr-metadata

Stringified JSON Pull Request metadata provided by GitHub Action redhat-plumbers-in-action/gather-pull-request-metadata.

Pull Request metadata has the following format: metadata format

  • default value: undefined
  • requirements: required

config-path

Path to configuration file. Configuration file format is described in: Configuration section.

  • default value: .github/tracker-validator.yml
  • requirements: optional

tracker

The tracker identificator. For example, for Bugzilla: tracker: 1234567.

  • default value: undefined
  • requirements: required

tracker-type

The tracker type. Currently supported: bugzilla and jira.

  • default value: undefined
  • requirements: required

component

Component name is used for validation if provided tracker is targeting the expected component. For example, for Bugzilla: component: systemd. If component is not provided, validation will be skipped.

  • default value: undefined
  • requirements: optional

bugzilla-instance

The URL of the Bugzilla instance on which will be performed API requests and validation of trackers. For example: bugzilla-instance: https://bugzilla.redhat.com.

  • default value: undefined
  • requirements: optional

bugzilla-api-token

The Bugzilla API token is used for performing API requests. The token should be stored as GitHub secret. Never paste the token directly into the workflow file.

  • default value: undefined
  • requirements: optional

jira-instance

The URL of the Jira instance on which will be performed API requests and validation of trackers. For example: jira-instance: https://issues.redhat.com.

  • default value: undefined
  • requirements: required

jiira-api-token

The Jira API token is used for performing API requests. The token should be stored as GitHub secret. Never paste the token directly into the workflow file.

  • default value: undefined
  • requirements: optional

token

GitHub token or PAT is used for creating comments on Pull Request and setting checks.

# required permission
permissions:
  checks: write
  pull-requests: write
  • default value: undefined
  • requirements: required
  • recomended value: secrets.GITHUB_TOKEN

Configuration

product

Product name is used for validation if provided tracker is targeting the expected product. For example, for Bugzilla: product: Red Hat Enterprise Linux 9. If product is not provided, validation will be skipped.

  • default value: undefined
  • requirements: optional

...

Limitations

...