Skip to content

Commit

Permalink
feat: update tracker status and add link to PR
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Jul 10, 2023
1 parent 23178b8 commit 3c362f2
Show file tree
Hide file tree
Showing 54 changed files with 106,449 additions and 3,584 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c

- name: Update tag
uses: Actions-R-Us/actions-tagger@68b8860d45b8d5a78fc2b0b4c7bb19da085b38c6
uses: Actions-R-Us/actions-tagger@v2
with:
publish_latest_tag: false
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,5 @@ lib/**/*
!.yarn/releases
!.yarn/sdks
!.yarn/versions

test.sh
144 changes: 126 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- markdownlint-disable MD033 MD041 -->
<p align="center">
<img src="https://github.com/redhat-plumbers-in-action/team/blob/70f67465cc46e02febb16aaa1cace2ceb82e6e5c/members/black-plumber.png" width="100" />
<h1 align="center">TypeScript Action</h1>
<h1 align="center">Tracker Validator</h1>
</p>

[![GitHub Marketplace][market-status]][market] [![Lint Code Base][linter-status]][linter] [![Unit Tests][test-status]][test] [![CodeQL][codeql-status]][codeql] [![Check dist/][check-dist-status]][check-dist]
Expand All @@ -10,42 +10,150 @@

<!-- Status links -->

[market]: https://github.com/marketplace/actions/typescript-action
[market]: https://github.com/marketplace/actions/tracker-validator
[market-status]: https://img.shields.io/badge/Marketplace-Typescript%20Action-blue.svg?colorA=24292e&colorB=0366d6&style=flat&longCache=true&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAM6wAADOsB5dZE0gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAERSURBVCiRhZG/SsMxFEZPfsVJ61jbxaF0cRQRcRJ9hlYn30IHN/+9iquDCOIsblIrOjqKgy5aKoJQj4O3EEtbPwhJbr6Te28CmdSKeqzeqr0YbfVIrTBKakvtOl5dtTkK+v4HfA9PEyBFCY9AGVgCBLaBp1jPAyfAJ/AAdIEG0dNAiyP7+K1qIfMdonZic6+WJoBJvQlvuwDqcXadUuqPA1NKAlexbRTAIMvMOCjTbMwl1LtI/6KWJ5Q6rT6Ht1MA58AX8Apcqqt5r2qhrgAXQC3CZ6i1+KMd9TRu3MvA3aH/fFPnBodb6oe6HM8+lYHrGdRXW8M9bMZtPXUji69lmf5Cmamq7quNLFZXD9Rq7v0Bpc1o/tp0fisAAAAASUVORK5CYII=

[linter]: https://github.com/redhat-plumbers-in-action/typescript-action/actions/workflows/lint.yml
[linter-status]: https://github.com/redhat-plumbers-in-action/typescript-action/actions/workflows/lint.yml/badge.svg
[linter]: https://github.com/redhat-plumbers-in-action/tracker-validator/actions/workflows/lint.yml
[linter-status]: https://github.com/redhat-plumbers-in-action/tracker-validator/actions/workflows/lint.yml/badge.svg

[test]: https://github.com/redhat-plumbers-in-action/typescript-action/actions/workflows/unit-tests.yml
[test-status]: https://github.com/redhat-plumbers-in-action/typescript-action/actions/workflows/unit-tests.yml/badge.svg
[test]: https://github.com/redhat-plumbers-in-action/tracker-validator/actions/workflows/unit-tests.yml
[test-status]: https://github.com/redhat-plumbers-in-action/tracker-validator/actions/workflows/unit-tests.yml/badge.svg

[codeql]: https://github.com/redhat-plumbers-in-action/typescript-action/actions/workflows/codeql-analysis.yml
[codeql-status]: https://github.com/redhat-plumbers-in-action/typescript-action/actions/workflows/codeql-analysis.yml/badge.svg
[codeql]: https://github.com/redhat-plumbers-in-action/tracker-validator/actions/workflows/codeql-analysis.yml
[codeql-status]: https://github.com/redhat-plumbers-in-action/tracker-validator/actions/workflows/codeql-analysis.yml/badge.svg

[check-dist]: https://github.com/redhat-plumbers-in-action/typescript-action/actions/workflows/check-dist.yml
[check-dist-status]: https://github.com/redhat-plumbers-in-action/typescript-action/actions/workflows/check-dist.yml/badge.svg
[check-dist]: https://github.com/redhat-plumbers-in-action/tracker-validator/actions/workflows/check-dist.yml
[check-dist-status]: https://github.com/redhat-plumbers-in-action/tracker-validator/actions/workflows/check-dist.yml/badge.svg

[codecov]: https://codecov.io/gh/redhat-plumbers-in-action/typescript-action
[codecov-status]: https://codecov.io/gh/redhat-plumbers-in-action/typescript-action/branch/main/graph/badge.svg
[codecov]: https://codecov.io/gh/redhat-plumbers-in-action/tracker-validator
[codecov-status]: https://codecov.io/gh/redhat-plumbers-in-action/tracker-validator/branch/main/graph/badge.svg

[mergify]: https://mergify.com
[mergify-status]: https://img.shields.io/endpoint.svg?url=https://api.mergify.com/v1/badges/redhat-plumbers-in-action/typescript-action&style=flat
[mergify-status]: https://img.shields.io/endpoint.svg?url=https://api.mergify.com/v1/badges/redhat-plumbers-in-action/tracker-validator&style=flat

<!-- -->

> ...
The purpose of this action is to offer reliable validator Red Hat trackers like [Bugzilla](https://bugzilla.redhat.com/) and [JIRA](https://issues.redhat.com).

## How does it work

> ...
> TBD
## Features

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

## Usage

> ...
```yml
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 }}
```
```yml
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
Expand All @@ -58,7 +166,7 @@ Action currently accepts the following options:
```yml
# ...

- uses: redhat-plumbers-in-action/typescript-action@v1
- uses: redhat-plumbers-in-action/tracker-validator@v1
with:
milliseconds: <number>

Expand Down
47 changes: 36 additions & 11 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,44 @@
---

name: 'Your name here'
name: Tracker Validator
description: Bugzilla and Jira validation for Pull Requests

description: 'Provide a description here'

author: 'Your name or organization here'
branding:
icon: bookmark
color: blue

inputs:
milliseconds: # change this
pr-metadata:
required: true
description: 'input description here'
default: 'default value if applicable'
description: Pull Request metadata

runs:
using: 'node16'
main: 'dist/index.js'
tracker:
description: tracker ID
tracker-type:
description: tracker type, supported values are 'bugzilla' and 'jira'

product:
description: Product name
component:
required: true
description: Component name

bugzilla-instance:
description: Bugzilla instance URL
default: https://bugzilla.redhat.com
bugzilla-api-token:
description: Bugzilla API TOKEN

...
jira-instance:
description: Jira instance URL
default: https://issues.redhat.com
jira-api-token:
description: Jira API TOKEN

token:
required: true
description: GitHub TOKEN or PAT

runs:
using: node16
main: dist/index.js
Loading

0 comments on commit 3c362f2

Please sign in to comment.