-
Notifications
You must be signed in to change notification settings - Fork 39
157 lines (151 loc) · 5.96 KB
/
Copy pathpr-checks.yaml
File metadata and controls
157 lines (151 loc) · 5.96 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
149
150
151
152
153
154
155
156
157
name: "Pull Request Checks"
on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
merge_group:
branches:
- main
types:
- checks_requested
permissions: {}
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@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
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)
# - refactor: code refactoring without behavior changes
# - revert: undoes a previous commit or change
# - adr: architectural decision records
types: |
fix
feat
chore
refactor
revert
adr
# 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
# - cli: related to otdfctl
# - 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
cli
deps
docs
sdk
policy
ers
kas
authz
examples
release
# release branches (e.g. release/service/v0.7)
release\/([a-z/]+\/)?v\d+\.\d+(\.\d+)?
# - 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@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
# 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.');
# }