Skip to content

Commit

Permalink
ci: use source-git-automation composite Action
Browse files Browse the repository at this point in the history
This will allow us maintain the source-git automation in separate repo
and reduce the duplication of the code and noise in the systemd repo.

rhel-only

Related: RHEL-1087
  • Loading branch information
jamacku committed Jan 12, 2024
1 parent 140e598 commit 79f6551
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 118 deletions.
55 changes: 4 additions & 51 deletions .github/workflows/source-git-automation-on-demand.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
---

name: Source git Automation Scheduled/On Demand
on:
schedule:
Expand Down Expand Up @@ -59,61 +57,16 @@ jobs:
pr-number: ${{ inputs.pr-number == 0 && fromJSON(needs.gather-pull-requests.outputs.pr-numbers) || fromJSON(needs.gather-pull-requests.outputs.pr-numbers-manual) }}

permissions:
# required for merging PRs
contents: write
statuses: write
checks: write
# required for PR comments and setting labels
pull-requests: write

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: Source-git Automation
uses: redhat-plumbers-in-action/source-git-automation@v1
with:
pr-number: ${{ matrix.pr-number }}

- if: ${{ !cancelled() }}
id: commit-linter
name: Lint Commits
uses: redhat-plumbers-in-action/advanced-commit-linter@v2
with:
pr-metadata: ${{ steps.metadata.outputs.metadata }}
token: ${{ secrets.GITHUB_TOKEN }}

# Validates tracker, changes tracker status, updates PR title
- if: ${{ !cancelled() }}
id: tracker-validator
name: Validate Tracker
uses: redhat-plumbers-in-action/tracker-validator@v1
with:
pr-metadata: ${{ steps.metadata.outputs.metadata }}
component: systemd
tracker: ${{ fromJSON(steps.commit-linter.outputs.validated-pr-metadata).validation.tracker.id }}
tracker-type: ${{ fromJSON(steps.commit-linter.outputs.validated-pr-metadata).validation.tracker.type }}
bugzilla-instance: https://bugzilla.redhat.com
bugzilla-api-token: ${{ secrets.BUGZILLA_API_TOKEN }}
jira-instance: https://issues.redhat.com
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}

- if: ${{ !cancelled() }}
name: Pull Request Validator
uses: redhat-plumbers-in-action/pull-request-validator@v1
with:
pr-metadata: ${{ steps.metadata.outputs.metadata }}
token: ${{ secrets.GITHUB_TOKEN }}

- id: auto-merge
name: Auto Merge
uses: redhat-plumbers-in-action/auto-merge@v1
with:
pr-metadata: ${{ steps.metadata.outputs.metadata }}
tracker: ${{ fromJSON(steps.commit-linter.outputs.validated-pr-metadata).validation.tracker.id }}
tracker-type: ${{ fromJSON(steps.commit-linter.outputs.validated-pr-metadata).validation.tracker.type }}
bugzilla-instance: https://bugzilla.redhat.com
bugzilla-api-token: ${{ secrets.BUGZILLA_API_TOKEN }}
jira-instance: https://issues.redhat.com
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
72 changes: 5 additions & 67 deletions .github/workflows/source-git-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,83 +26,21 @@ jobs:
with:
name: pr-metadata

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

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

permissions:
statuses: write
checks: write
pull-requests: write

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

# Validates tracker, changes tracker status, updates PR title
tracker-validator:
if: ${{ !cancelled() }}
needs: [ download-metadata, commit-linter ]
runs-on: ubuntu-latest

permissions:
checks: write
pull-requests: write

steps:
- name: Validate Tracker
uses: redhat-plumbers-in-action/tracker-validator@v1
with:
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
component: systemd
tracker: ${{ fromJSON(needs.commit-linter.outputs.validated-pr-metadata).validation.tracker.id }}
tracker-type: ${{ fromJSON(needs.commit-linter.outputs.validated-pr-metadata).validation.tracker.type }}
bugzilla-instance: https://bugzilla.redhat.com
bugzilla-api-token: ${{ secrets.BUGZILLA_API_TOKEN }}
jira-instance: https://issues.redhat.com
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}

pull-request-validator:
needs: [ download-metadata ]
runs-on: ubuntu-latest

permissions:
checks: write
pull-requests: write

steps:
- name: Pull Request Validator
uses: redhat-plumbers-in-action/pull-request-validator@v1
with:
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
token: ${{ secrets.GITHUB_TOKEN }}

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

permissions:
# required for merging PRs
contents: write
checks: write
# required for PR comments and setting labels
pull-requests: write

steps:
- name: Auto Merge
uses: redhat-plumbers-in-action/auto-merge@v1
- name: Source-git Automation
uses: redhat-plumbers-in-action/source-git-automation@v1
with:
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
tracker: ${{ fromJSON(needs.commit-linter.outputs.validated-pr-metadata).validation.tracker.id }}
tracker-type: ${{ fromJSON(needs.commit-linter.outputs.validated-pr-metadata).validation.tracker.type }}
bugzilla-instance: https://bugzilla.redhat.com
bugzilla-api-token: ${{ secrets.BUGZILLA_API_TOKEN }}
jira-instance: https://issues.redhat.com
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 79f6551

Please sign in to comment.