-
Notifications
You must be signed in to change notification settings - Fork 53
112 lines (95 loc) · 4.08 KB
/
commands.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
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
name: GDevelop Extensions PR commands
on: issue_comment
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 occured 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 occured. 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') }}
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 }}
run: |
curl -L $(echo $BODY | grep -ioEh 'https?://\S+.zip' -m1) -o /tmp/ext.zip
unzip -o /tmp/ext.zip -d ./extensions/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: Commit and push
if: ${{ contains(env.BUILD_LOGS, 'successfully updated') }}
run: |
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
git add extensions
git commit -m "Updated extension"
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 updated the extension."
- name: Notify build error
if: ${{ !contains(env.BUILD_LOGS, 'successfully updated') }}
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 occured. See logs at https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}."