Skip to content

Commit 12653be

Browse files
committed
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-1086
1 parent 468acdc commit 12653be

File tree

2 files changed

+12
-121
lines changed

2 files changed

+12
-121
lines changed
Lines changed: 7 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
---
2-
31
name: Source git Automation Scheduled/On Demand
42
on:
53
schedule:
@@ -59,62 +57,17 @@ jobs:
5957
matrix:
6058
pr-number: ${{ inputs.pr-number == 0 && fromJSON(needs.gather-pull-requests.outputs.pr-numbers) || fromJSON(needs.gather-pull-requests.outputs.pr-numbers-manual) }}
6159

62-
permissions: write-all
63-
# contents: write
64-
# statuses: write
65-
# checks: write
66-
# pull-requests: write
60+
permissions:
61+
# required for merging PRs
62+
contents: write
63+
# required for PR comments and setting labels
64+
pull-requests: write
6765

6866
steps:
69-
- name: Repository checkout
70-
uses: actions/checkout@v3
71-
72-
- id: metadata
73-
name: Gather Pull Request Metadata
74-
uses: redhat-plumbers-in-action/gather-pull-request-metadata@v1
67+
- name: Source-git Automation
68+
uses: redhat-plumbers-in-action/source-git-automation@v1
7569
with:
7670
pr-number: ${{ matrix.pr-number }}
77-
78-
- if: ${{ !cancelled() }}
79-
id: commit-linter
80-
name: Lint Commits
81-
uses: redhat-plumbers-in-action/advanced-commit-linter@v2
82-
with:
83-
pr-metadata: ${{ steps.metadata.outputs.metadata }}
84-
token: ${{ secrets.GITHUB_TOKEN }}
85-
86-
# Validates tracker, changes tracker status, updates PR title
87-
- if: ${{ !cancelled() }}
88-
id: tracker-validator
89-
name: Validate Tracker
90-
uses: redhat-plumbers-in-action/tracker-validator@v1
91-
with:
92-
pr-metadata: ${{ steps.metadata.outputs.metadata }}
93-
component: systemd
94-
tracker: ${{ fromJSON(steps.commit-linter.outputs.validated-pr-metadata).validation.tracker.id }}
95-
tracker-type: ${{ fromJSON(steps.commit-linter.outputs.validated-pr-metadata).validation.tracker.type }}
96-
bugzilla-instance: https://bugzilla.redhat.com
97-
bugzilla-api-token: ${{ secrets.BUGZILLA_API_TOKEN }}
98-
jira-instance: https://issues.redhat.com
99-
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
100-
token: ${{ secrets.GITHUB_TOKEN }}
101-
102-
- if: ${{ !cancelled() }}
103-
name: Pull Request Validator
104-
uses: redhat-plumbers-in-action/pull-request-validator@v1
105-
with:
106-
pr-metadata: ${{ steps.metadata.outputs.metadata }}
107-
token: ${{ secrets.GITHUB_TOKEN }}
108-
109-
- id: auto-merge
110-
name: Auto Merge
111-
uses: redhat-plumbers-in-action/auto-merge@v1
112-
with:
113-
pr-metadata: ${{ steps.metadata.outputs.metadata }}
114-
tracker: ${{ fromJSON(steps.commit-linter.outputs.validated-pr-metadata).validation.tracker.id }}
115-
tracker-type: ${{ fromJSON(steps.commit-linter.outputs.validated-pr-metadata).validation.tracker.type }}
116-
bugzilla-instance: https://bugzilla.redhat.com
11771
bugzilla-api-token: ${{ secrets.BUGZILLA_API_TOKEN }}
118-
jira-instance: https://issues.redhat.com
11972
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
12073
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/source-git-automation.yml

Lines changed: 5 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -26,83 +26,21 @@ jobs:
2626
with:
2727
name: pr-metadata
2828

29-
commit-linter:
29+
source-git-automation:
3030
needs: [ download-metadata ]
3131
runs-on: ubuntu-latest
3232

33-
outputs:
34-
validated-pr-metadata: ${{ steps.commit-linter.outputs.validated-pr-metadata }}
35-
36-
permissions:
37-
statuses: write
38-
checks: write
39-
pull-requests: write
40-
41-
steps:
42-
- id: commit-linter
43-
name: Lint Commits
44-
uses: redhat-plumbers-in-action/advanced-commit-linter@v2
45-
with:
46-
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
47-
token: ${{ secrets.GITHUB_TOKEN }}
48-
49-
# Validates tracker, changes tracker status, updates PR title
50-
tracker-validator:
51-
if: ${{ !cancelled() }}
52-
needs: [ download-metadata, commit-linter ]
53-
runs-on: ubuntu-latest
54-
55-
permissions:
56-
checks: write
57-
pull-requests: write
58-
59-
steps:
60-
- name: Validate Tracker
61-
uses: redhat-plumbers-in-action/tracker-validator@v1
62-
with:
63-
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
64-
component: systemd
65-
tracker: ${{ fromJSON(needs.commit-linter.outputs.validated-pr-metadata).validation.tracker.id }}
66-
tracker-type: ${{ fromJSON(needs.commit-linter.outputs.validated-pr-metadata).validation.tracker.type }}
67-
bugzilla-instance: https://bugzilla.redhat.com
68-
bugzilla-api-token: ${{ secrets.BUGZILLA_API_TOKEN }}
69-
jira-instance: https://issues.redhat.com
70-
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
71-
token: ${{ secrets.GITHUB_TOKEN }}
72-
73-
pull-request-validator:
74-
needs: [ download-metadata ]
75-
runs-on: ubuntu-latest
76-
77-
permissions:
78-
checks: write
79-
pull-requests: write
80-
81-
steps:
82-
- name: Pull Request Validator
83-
uses: redhat-plumbers-in-action/pull-request-validator@v1
84-
with:
85-
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
86-
token: ${{ secrets.GITHUB_TOKEN }}
87-
88-
auto-merge:
89-
needs: [ download-metadata, commit-linter, tracker-validator, pull-request-validator ]
90-
runs-on: ubuntu-latest
91-
9233
permissions:
34+
# required for merging PRs
9335
contents: write
94-
checks: write
36+
# required for PR comments and setting labels
9537
pull-requests: write
9638

9739
steps:
98-
- name: Auto Merge
99-
uses: redhat-plumbers-in-action/auto-merge@v1
40+
- name: Source-git Automation
41+
uses: redhat-plumbers-in-action/source-git-automation@v1
10042
with:
10143
pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
102-
tracker: ${{ fromJSON(needs.commit-linter.outputs.validated-pr-metadata).validation.tracker.id }}
103-
tracker-type: ${{ fromJSON(needs.commit-linter.outputs.validated-pr-metadata).validation.tracker.type }}
104-
bugzilla-instance: https://bugzilla.redhat.com
10544
bugzilla-api-token: ${{ secrets.BUGZILLA_API_TOKEN }}
106-
jira-instance: https://issues.redhat.com
10745
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
10846
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)