Skip to content

CheatCode

CheatCode #2486

Workflow file for this run

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}}."