forked from hackforla/website
-
Notifications
You must be signed in to change notification settings - Fork 2
84 lines (76 loc) · 3.21 KB
/
issue-trigger.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
name: Issue Trigger
on:
issues:
types: [opened, transferred, assigned]
jobs:
# Adds newly created issues onto project board in column 'New Issue Approval'
Add-Issue-To-Project-Board:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'issues' && github.event.action == 'opened' }}
steps:
- name: Add issue to project board
uses: alex-page/[email protected]
id: add-issue-project-board
with:
project: Project Board
column: New Issue Approval
repo-token: ${{ secrets.TEST_GHAS }}
Add-Missing-Labels-To-Issues:
runs-on: ubuntu-latest
# Only trigger this action when an issue is newly created
if: ${{ github.event_name == 'issues' && (github.event.action == 'opened' || github.event.action == 'transferred')}}
steps:
- uses: actions/checkout@v4
# Check if the issue has required labels
- name: Check Labels
uses: actions/github-script@v7
id: check-labels
with:
script: |
const script = require('./github-actions/trigger-issue/add-missing-labels-to-issues/check-labels.js')
const checkLabels = script({g: github, c: context})
return checkLabels
#Checks which teams the user is on
- uses: tspascoal/get-user-teams-membership@v3
id: checkUserMember
with:
username: ${{ github.actor }}
organization: 'hackforla'
team: 'website-write'
GITHUB_TOKEN: ${{ secrets.TEST_GHAS }}
# Checks if user is on the website-write-team
- if: ${{ steps.checkUserMember.outputs.isTeamMember == 'true' }}
# Post comment based on the previous action's results
name: Post Comment
uses: actions/github-script@v7
id: post-comment
with:
script: |
const results = ${{ steps.check-labels.outputs.result }}
const script = require('./github-actions/trigger-issue/add-missing-labels-to-issues/post-labels-comment.js')
script({g: github, c:context}, results)
#Asking for preliminary update when issue is assigned
Ask-For-Preliminary-update:
runs-on: ubuntu-latest
#Triggers when the issue is newly assigned
if: ${{ github.event_name == 'issues' && github.event.action == 'assigned'}}
steps:
- uses: actions/checkout@v4
# Check if the issue has the required roles
- name: Check Labels Prelim
uses: actions/github-script@v7
id: check-labels-prelim
with:
script: |
const script = require('./github-actions/trigger-issue/add-preliminary-comment/check-label-preliminary-update.js')
const checklabels = script({g: github, c: context})
return checklabels
# Post the comment based on the result of the previous step
- name: Post assigning issue comment
id: assigned-comment
uses: actions/github-script@v7
with:
script: |
const results = ${{ steps.check-labels-prelim.outputs.result }}
const script = require('./github-actions/trigger-issue/add-preliminary-comment/preliminary-update-comment.js')
script({g: github, c:context},results)