-
Notifications
You must be signed in to change notification settings - Fork 73
142 lines (119 loc) · 5.37 KB
/
commands.yml
File metadata and controls
142 lines (119 loc) · 5.37 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
name: GDevelop Extensions PR commands
on:
issue_comment:
types: [created, edited]
jobs:
merge:
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '!merge') }}
steps:
- uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- uses: actions/checkout@v3
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
fetch-depth: 0
- name: Merge new commits from main
run: |
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
git merge -X theirs origin/main -m "Merge main into this branch"
- name: Rebuild the database
run: |
npm i
echo 'BUILD_LOGS<<EOF' >> $GITHUB_ENV
node scripts/generate-extensions-registry.js --disable-exit-code >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Commit and push
if: ${{ contains(env.BUILD_LOGS, 'successfully updated') }}
run: |
git push
- name: Notify success
if: ${{ contains(env.BUILD_LOGS, 'successfully updated') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr comment ${{ github.event.issue.number }} --body "✅ Successfully merged main into this branch."
- name: Notify error
if: ${{ !contains(env.BUILD_LOGS, 'successfully updated') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.issue.number }} --body "A build error occurred while merging:
\`\`\`${{ env.BUILD_LOGS }}
\`\`\`"
- name: Notify any error
if: ${{ failure() }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.issue.number }} --body "❗ An internal error has occurred. See logs at https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}."
update:
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '!update') && !contains(github.event.comment.body, 'Uploading') }}
steps:
- uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- uses: actions/checkout@v3
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
- name: Download extension
env:
BODY: ${{ github.event.comment.body }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
FILEURL=$(echo $BODY | grep -ioEh 'https?://\S+.zip' -m1)
curl -L $FILEURL -o /tmp/ext.zip
unzip -o /tmp/ext.zip -d ./extensions/${{ contains(github.event.issue.labels.*.name, '🔍 Reviewed extension') && 'reviewed' || 'community' }}
- name: Rebuild the database
run: |
npm i
echo 'BUILD_LOGS<<EOF' >> $GITHUB_ENV
node scripts/generate-extensions-registry.js --disable-exit-code >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Setup git config
run: |
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
- name: Check for changed file
id: git-diff
run: |
git diff --quiet || echo "changed=true" >> $GITHUB_OUTPUT
shell: bash
- name: Commit and push
if: ${{ steps.git-diff.outputs.changed == 'true' && contains(env.BUILD_LOGS, 'No fatal error found') }}
run: |
git add extensions
git commit -m "Updated extension"
git push
- name: Notify no changed
if: ${{ steps.git-diff.outputs.changed != 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr comment ${{ github.event.issue.number }} --body "❗ No updates found. Please check your file."
- name: Notify success
if: ${{ steps.git-diff.outputs.changed == 'true' && contains(env.BUILD_LOGS, 'successfully updated') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr comment ${{ github.event.issue.number }} --body "✅ Successfully updated the extension."
- name: Notify non-fatal build error
if: ${{ steps.git-diff.outputs.changed == 'true' && contains(env.BUILD_LOGS, 'No fatal error found') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.issue.number }} --body "Extension updated with errors:
\`\`\`${{ env.BUILD_LOGS }}
\`\`\`"
- name: Notify fatal build error
if: ${{ steps.git-diff.outputs.changed == 'true' && !contains(env.BUILD_LOGS, 'successfully updated') && !contains(env.BUILD_LOGS, 'No fatal error found') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.issue.number }} --body "Can't update the extension, as it doesn't pass automatic tests:
\`\`\`${{ env.BUILD_LOGS }}
\`\`\`"
- name: Notify any error
if: ${{ failure() }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.issue.number }} --body "❗ An internal error has occurred. See logs at https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}."