Skip to content

Commit dc36166

Browse files
committed
AAE-35226 Add reusable workflow for dependabot flow management
1 parent 867906d commit dc36166

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "PR Review check"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
github-token:
7+
description: >
8+
Token used to enable auto-merge, comment on the PR, and change PR milestone/label.
9+
This token CANNOT be the default `GITHUB_TOKEN` if auto-merge is set, otherwise the merge of the PR will not trigger a build.
10+
Or similarly, if labeled and milestoned events are expected to trigger a new build.
11+
required: true
12+
type: string
13+
trigger-labels:
14+
description: JSON object mapping the list of labels that should trigger the validation
15+
required: true
16+
type: string
17+
milestone-name:
18+
description: Milestone to set on the PR when validation is triggered
19+
required: true
20+
type: string
21+
22+
env:
23+
DEPENDABOT_CREATOR: 'dependabot[bot]'
24+
25+
permissions:
26+
contents: read # Required to read repository content
27+
pull-requests: write # Required to edit PR (milestones, labels, auto-merge)
28+
issues: write # Required to create comments on PRs
29+
30+
jobs:
31+
check:
32+
if: github.secret_source != 'None'
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Trigger validation on approval
36+
if: github.event_name == 'pull_request_review'
37+
uses: Alfresco/alfresco-build-tools/.github/actions/github-trigger-approved-pr@c295ecd6ca6b9c473dcada1e0478cdeaba79d5ea # v9.0.0
38+
with:
39+
creator: ${{ env.DEPENDABOT_CREATOR }}
40+
github-token: ${{ inputs.github-token }}
41+
milestone-on-approval: ${{ inputs.milestone-name }}
42+
auto-merge-on-approval: true
43+
44+
- name: Trigger validation on labeling, unless token is readonly (dependabot/fork) or milestone
45+
if: github.event_name == 'pull_request' && github.event.action == 'labeled' && github.secret_source == 'Actions' && inputs.milestone-name != ''
46+
uses: Alfresco/alfresco-build-tools/.github/actions/github-trigger-labeled-pr@c295ecd6ca6b9c473dcada1e0478cdeaba79d5ea # v9.0.0
47+
with:
48+
github-token: ${{ inputs.github-token }}
49+
labels: ${{ inputs.trigger-labels }}
50+
milestone: ${{ inputs.milestone-name }}
51+
force-trigger: true

0 commit comments

Comments
 (0)