-
Notifications
You must be signed in to change notification settings - Fork 5
94 lines (82 loc) · 3.12 KB
/
project-automation.yml
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
name: Issue & PR Automation
on:
issues:
types:
- opened
- reopened
pull_request_target:
types:
- opened
- reopened
- review_requested
env:
PRIMARY_CODEOWNER: '@ideadude'
PROJECT_ORG: gocodebox
PROJECT_ID: 18
jobs:
#######################################
# Add issue to the Development project.
#######################################
issue-to-project:
name: Move Issue to Project Board
runs-on: ubuntu-latest
if: ( 'issues' == github.event_name && ( 'opened' == github.event.action || 'reopened' == github.event.action ) )
steps:
- name: Add Issue to Project
uses: leonsteinhaeuser/project-beta-automations@v2.1.0
with:
gh_token: ${{ secrets.ORG_WORKFLOWS }}
organization: ${{ env.PROJECT_ORG }}
project_id: ${{ env.PROJECT_ID }}
resource_node_id: ${{ github.event.issue.node_id }}
status_value: "Awaiting Triage"
# - uses: hmarr/debug-action@v2
####################################
# Assign to the project's CODEOWNER.
####################################
issue-assig:
name: Assign Issue to the Primary CODEOWNER
runs-on: ubuntu-latest
if: ( 'issues' == github.event_name && ( 'opened' == github.event.action || 'reopened' == github.event.action ) && ( null == github.event.issue.assignee ) )
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check CODEOWNERS file existence
id: codeowners_file_exists
uses: andstor/file-existence-action@v2
with:
files: .github/CODEOWNERS
- name: Parse CODEOWNERS file
id: codeowner
if: steps.codeowners_file_exists.outputs.files_exists == 'true'
uses: SvanBoxel/codeowners-action@v1
with:
path: .github/CODEOWNERS
- name: Update PRIMARY_CODEOWNER env var
if: steps.codeowners_file_exists.outputs.files_exists == 'true'
run: |
echo PRIMARY_CODEOWNER=$( echo '${{ steps.codeowner.outputs.codeowners }}' | jq -r '."*"[0]' ) >> $GITHUB_ENV
- name: Strip @ from username
run: |
echo "PRIMARY_CODEOWNER=${PRIMARY_CODEOWNER#?}" >> $GITHUB_ENV
- name: Assign issue
uses: pozil/auto-assign-issue@v1
with:
repo-token: ${{ secrets.ORG_WORKFLOWS }}
assignees: ${{ env.PRIMARY_CODEOWNER }}
#####################################
# Add PRs to the Development project.
#####################################
pr-to-board:
name: Move Pull Request to the Project Board
runs-on: ubuntu-latest
if: ( 'pull_request_target' == github.event_name && ( 'opened' == github.event.action || 'reopened' == github.event.action || 'review_requested' == github.event.action ) )
steps:
- name: Mark PR as Awaiting Review
uses: leonsteinhaeuser/project-beta-automations@v2.1.0
with:
gh_token: ${{ secrets.ORG_WORKFLOWS }}
organization: ${{ env.PROJECT_ORG }}
project_id: ${{ env.PROJECT_ID }}
resource_node_id: ${{ github.event.pull_request.node_id }}
status_value: "Awaiting Review"