[Community] [Hedgehog platformer] A platformer engine for Sonic-like games #3481
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 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 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/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, 'successfully updated') }} | |
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 build error | |
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 "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}}." |