Skip to content

Commit

Permalink
ci: first part of the source-git automation - commit linter
Browse files Browse the repository at this point in the history
Add a GitHub Workflow that is triggered on `workflow_run` events.
It uses metadata provided by `redhat-plumbers-in-action/gather-pull-request-metadata`
GitHub Action to get the PR number and the commit metadata.
The commit metadata is then used to check if the commit message contains
all required information (tracker and upstream reference). GitHub Action
responsible for commit verification `redhat-plumbers-in-action/advanced-commit-linter`
is configured via the `advanced-commit-linter.yml` file.

rhel-only

Related: #2190153
  • Loading branch information
jamacku authored and msekletar committed Apr 27, 2023
1 parent c205125 commit 3a8bf07
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/advanced-commit-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
policy:
cherry-pick:
upstream:
- github: systemd/systemd
- github: systemd/systemd-stable
exception:
note:
- rhel-only
tracker:
- keyword:
- 'Resolves: #?'
- 'Related: #?'
- 'Reverts: #?'
issue-format:
- '\d+$'
url: 'https://bugzilla.redhat.com/show_bug.cgi?id='
- keyword:
- 'Resolves: '
- 'Related: '
- 'Reverts: '
issue-format:
- 'RHEL-\d+$'
url: 'https://issues.redhat.com/browse/'
45 changes: 45 additions & 0 deletions .github/workflows/source-git-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Source git Automation
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:
statuses: write
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 }}

0 comments on commit 3a8bf07

Please sign in to comment.