-
Notifications
You must be signed in to change notification settings - Fork 168
113 lines (111 loc) · 3.95 KB
/
pr-change-check-patch-day.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
name: PR Check Patch Day / Prep
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
paths:
- 'FFXIVClientStructs/**/*.cs'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore
- name: Run CExporter
working-directory: ./
run: dotnet run --project CExporter/CExporter.csproj -c Release
- name: Check error txt file for content
id: check_error
run: |
if [ -s ./ida/errors.txt ]; then
echo "error=true" >> $GITHUB_OUTPUT
else
echo "error=false" >> $GITHUB_OUTPUT
fi
- name: Upload error txt to comment
if: steps.check_error.outputs.error == 'true'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const content = fs.readFileSync('./ida/errors.txt', 'utf8');
const comments = (await github.rest.issues.listComments({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo
})).data
const comment = comments.filter(comment => comment.user.login === 'github-actions[bot]');
if (comment.length > 0) {
comment.forEach(comment => {
github.rest.issues.deleteComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo
});
});
}
github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: content
});
github.rest.issues.addLabels({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["requested changes"]
})
- name: Exit with error
if: steps.check_error.outputs.error == 'true'
run: exit 1
- name: Cleanup issue
if: steps.check_error.outputs.error == 'false'
uses: actions/github-script@v7
with:
script: |
const comments = (await github.rest.issues.listComments({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo
})).data
const comment = comments.filter(comment => comment.user.login === 'github-actions[bot]');
if (comment.length > 0) {
comment.forEach(comment => {
github.rest.issues.deleteComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo
});
});
}
const labels = (await github.rest.issues.listLabelsOnIssue({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo
})).data
const label = labels.find(label => label.name === 'requested changes');
if (label) {
github.rest.issues.removeLabel({
issue_number: context.payload.pull_request.number,
name: 'requested changes',
owner: context.repo.owner,
repo: context.repo.repo
});
}
- uses: actions/upload-artifact@v4
with:
name: structs.yml
path: ./ida/ffxiv_structs.yml
retention-days: 7