-
Notifications
You must be signed in to change notification settings - Fork 11
146 lines (140 loc) · 5.57 KB
/
pr-checks.yaml
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
name: "Pull Request Checks"
on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
merge_group:
branches:
- main
types:
- checks_requested
jobs:
pull-request-checks:
permissions:
pull-requests: write
runs-on: ubuntu-22.04
steps:
- name: "Conventional Commits"
if: contains(fromJSON('["pull_request", "pull_request_target"]'), github.event_name)
id: conventional-commits
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Types include:
# - fix: fixes
# - feat: features and enhancements
# - chore: non-feature or enhancement (i.e. docs, ci, linting, automated, etc)
types: |
fix
feat
chore
refactor
revert
# Scopes include:
# - main: used for automated releases
# - core: related to any core need such as the core service or monorepo
# - ci: anything related to ci
# - deps: dependency update
# - docs: anything related solely to documentation
# - sdk: related to sdk changes in the /sdk directory
# - policy: related to policy service changes (i.e. /service/policy)
# - kas: related to key access service changes (i.e. /service/kas)
# - authz: related to the authorization service changes (i.e. /service/authorization)
scopes: |
main
core
ci
deps
docs
sdk
policy
kas
authz
examples
# - name: "Issue Accociated with Pull Request"
# id: issue-associated
# if: contains(fromJSON('["pull_request", "pull_request_target"]'), github.event_name) && !contains(fromJSON('["dependabot[bot]", "opentdf-automation[bot]"]'), github.actor)
# uses: actions/github-script@660ec11d825b714d112a6bb9727086bc2cc500b2
# with:
# script: |
# core.debug(JSON.stringify(context));
# const query = `query ($owner: String!, $name: String!, $number: Int!) {
# repository(owner: $owner, name: $name) {
# pullRequest(number: $number) {
# id
# closingIssuesReferences(first: 50) {
# edges {
# node {
# id
# body
# number
# title
# }
# }
# }
# comments(last: 100) {
# edges {
# node {
# id
# body
# author {
# login
# }
# isMinimized
# }
# }
# }
# }
# }
# }`;
# const variables = {
# owner: context.repo.owner,
# name: context.repo.repo,
# number: context.issue.number
# }
# const result = await github.graphql(query, variables)
# core.debug(JSON.stringify(result));
# if (result.repository.pullRequest.closingIssuesReferences.edges.length === 0) {
# const comments = result.repository.pullRequest.comments.edges;
# for (const comment of comments) {
# // Minimize the previous comment if one exists
# console.debug(comment);
# console.debug(comment.node.body.match(/<!-- associated-issue-action -->/g) != null);
# if (comment.node.author.login === 'github-actions' && !comment.node.isMinimized && comment.node.body.match(/<!-- associated-issue-action -->/g) != null) {
# const minimizeCommentMutation = `mutation minimizeComment($id: ID!) {
# minimizeComment(input: { subjectId: $id, classifier: OUTDATED }) {
# minimizedComment {
# isMinimized
# }
# }
# }`;
# const minimizeCommentVariables = {
# id: comment.node.id
# }
# await github.graphql(minimizeCommentMutation, minimizeCommentVariables)
# }
# }
# const body = `
# > [!WARNING]
# > This pull request does not reference any issues. Please add a reference to an issue in the body of the pull request description.
# <!-- associated-issue-action -->`;
# const createCommentMutation = `mutation createComment($id: ID!, $body: String!) {
# addComment(input: { subjectId: $id, body: $body }) {
# commentEdge {
# node {
# id
# }
# }
# }
# }`;
# const createCommentVariables = {
# id: result.repository.pullRequest.id,
# body: body
# }
# await github.graphql(createCommentMutation, createCommentVariables)
# core.setFailed('This pull request does not reference any issues. Please add a reference to an issue in the body of the pull request description.');
# }