From 5d0fc67965b48e05c28d0993368a3982efd03b4b Mon Sep 17 00:00:00 2001 From: Jan Macku Date: Fri, 12 Jan 2024 16:01:43 +0100 Subject: [PATCH] ci: use source-git-automation composite Action 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 --- .../source-git-automation-on-demand.yml | 55 ++------------ .github/workflows/source-git-automation.yml | 72 ++----------------- 2 files changed, 9 insertions(+), 118 deletions(-) diff --git a/.github/workflows/source-git-automation-on-demand.yml b/.github/workflows/source-git-automation-on-demand.yml index 948708916d..0c72f9f210 100644 --- a/.github/workflows/source-git-automation-on-demand.yml +++ b/.github/workflows/source-git-automation-on-demand.yml @@ -1,5 +1,3 @@ ---- - name: Source git Automation Scheduled/On Demand on: schedule: @@ -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 }} diff --git a/.github/workflows/source-git-automation.yml b/.github/workflows/source-git-automation.yml index 95819baa8b..b6cefa67b1 100644 --- a/.github/workflows/source-git-automation.yml +++ b/.github/workflows/source-git-automation.yml @@ -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 }}