Source git Automation #118
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' && | |
github.repository == 'redhat-plumbers/systemd-rhel9' | |
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 | |
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: | |
contents: write | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Auto Merge | |
uses: redhat-plumbers-in-action/auto-merge@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 }} |