-
-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (137 loc) · 6.29 KB
/
auto-assign.yml
File metadata and controls
148 lines (137 loc) · 6.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Project Board Automation
on:
workflow_call:
inputs:
project:
description: Optional GitHub Project V2 number for consumer repositories. When omitted, php-fast-forward repositories default to the first organization project.
required: false
type: string
default: ''
issues:
types: [opened, reopened, closed]
pull_request_target:
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft, closed]
pull_request_review:
types: [submitted, dismissed]
permissions:
contents: read
issues: write
pull-requests: write
repository-projects: write
jobs:
resolve-project:
runs-on: ubuntu-latest
outputs:
project_number: ${{ steps.resolve.outputs.project-number }}
steps:
- uses: actions/checkout@v6
- name: Checkout dev-tools workflow action source
uses: actions/checkout@v6
with:
repository: php-fast-forward/dev-tools
ref: ${{ github.repository == 'php-fast-forward/dev-tools' && (github.event_name == 'pull_request_target' && github.event.pull_request.base.sha || github.sha) || 'main' }}
path: .dev-tools-actions
sparse-checkout: |
.github/actions
- id: resolve
uses: ./.dev-tools-actions/.github/actions/project-board/resolve
with:
project: ${{ inputs.project || vars.PROJECT || '' }}
assign-author:
if: ${{ github.event_name == 'pull_request_target' && (github.event.action == 'opened' || github.event.action == 'reopened') }}
runs-on: ubuntu-latest
steps:
- name: Auto assign PR author
uses: toshimaru/auto-author-assign@v3.0.1
with:
repo-token: ${{ github.token }}
sync-issue-status:
needs: resolve-project
if: github.event_name == 'issues' && needs.resolve-project.outputs.project_number != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Checkout dev-tools workflow action source
uses: actions/checkout@v6
with:
repository: php-fast-forward/dev-tools
ref: ${{ github.repository == 'php-fast-forward/dev-tools' && (github.event_name == 'pull_request_target' && github.event.pull_request.base.sha || github.sha) || 'main' }}
path: .dev-tools-actions
sparse-checkout: |
.github/actions
- uses: ./.dev-tools-actions/.github/actions/project-board/sync-status
with:
organization: ${{ github.repository_owner }}
project: ${{ needs.resolve-project.outputs.project_number }}
resource-node-id: ${{ github.event.issue.node_id }}
status-value: ${{ github.event.action == 'closed' && 'Merged' || 'Backlog' }}
sync-pull-request-metadata:
needs: resolve-project
if: github.event_name == 'pull_request_target' && needs.resolve-project.outputs.project_number != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Checkout dev-tools workflow action source
uses: actions/checkout@v6
with:
repository: php-fast-forward/dev-tools
ref: ${{ github.repository == 'php-fast-forward/dev-tools' && (github.event_name == 'pull_request_target' && github.event.pull_request.base.sha || github.sha) || 'main' }}
path: .dev-tools-actions
sparse-checkout: |
.github/actions
- uses: ./.dev-tools-actions/.github/actions/project-board/sync-linked-pr-metadata
sync-pull-request-status:
needs: resolve-project
if: github.event_name == 'pull_request_target' && needs.resolve-project.outputs.project_number != ''
runs-on: ubuntu-latest
outputs:
linked_issue_node_id: ${{ steps.compute.outputs.linked-issue-node-id }}
linked_issue_status: ${{ steps.compute.outputs.linked-issue-status }}
pull_request_status: ${{ steps.compute.outputs.pull-request-status }}
steps:
- uses: actions/checkout@v6
- name: Checkout dev-tools workflow action source
uses: actions/checkout@v6
with:
repository: php-fast-forward/dev-tools
ref: ${{ github.repository == 'php-fast-forward/dev-tools' && (github.event_name == 'pull_request_target' && github.event.pull_request.base.sha || github.sha) || 'main' }}
path: .dev-tools-actions
sparse-checkout: |
.github/actions
- id: compute
uses: ./.dev-tools-actions/.github/actions/project-board/resolve-pr-status
- uses: ./.dev-tools-actions/.github/actions/project-board/sync-status
with:
organization: ${{ github.repository_owner }}
project: ${{ needs.resolve-project.outputs.project_number }}
resource-node-id: ${{ github.event.pull_request.node_id }}
status-value: ${{ steps.compute.outputs.pull-request-status }}
- if: steps.compute.outputs.linked-issue-node-id != '' && steps.compute.outputs.linked-issue-status != ''
uses: ./.dev-tools-actions/.github/actions/project-board/sync-status
with:
organization: ${{ github.repository_owner }}
project: ${{ needs.resolve-project.outputs.project_number }}
resource-node-id: ${{ steps.compute.outputs.linked-issue-node-id }}
status-value: ${{ steps.compute.outputs.linked-issue-status }}
sync-review-state:
needs: resolve-project
if: github.event_name == 'pull_request_review' && needs.resolve-project.outputs.project_number != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Checkout dev-tools workflow action source
uses: actions/checkout@v6
with:
repository: php-fast-forward/dev-tools
ref: ${{ github.repository == 'php-fast-forward/dev-tools' && (github.event_name == 'pull_request_target' && github.event.pull_request.base.sha || github.sha) || 'main' }}
path: .dev-tools-actions
sparse-checkout: |
.github/actions
- id: compute
uses: ./.dev-tools-actions/.github/actions/project-board/resolve-review-status
- uses: ./.dev-tools-actions/.github/actions/project-board/sync-status
with:
organization: ${{ github.repository_owner }}
project: ${{ needs.resolve-project.outputs.project_number }}
resource-node-id: ${{ github.event.pull_request.node_id }}
status-value: ${{ steps.compute.outputs.status }}