Skip to content

New extension: Wortal SDK #1413

New extension: Wortal SDK

New extension: Wortal SDK #1413

Workflow file for this run

name: Extension issue to Pull Request conversion
on:
issues:
types: [labeled, edited]
jobs:
generate-pr:
# Only run it on extensions submissions (tag is ensured via the new issue form)
if: ${{ contains(github.event.issue.labels.*.name, '✨ New extension') || contains(github.event.issue.labels.*.name, '🔄 Extension update') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- name: Download extension
env:
BODY: ${{ github.event.issue.body }}
run: |
curl -L $(echo $BODY | grep -ioEh 'https?://\S+.zip' -m2 | tail -n1) -o /tmp/ext.zip
- name: Extract and verify extension
uses: actions/github-script@v6
with:
script: |
const { extractExtension } = require('./scripts/extract-extension.js');
const { verifyExtension } = require('./scripts/check-single-extension.js')
const { error, extensionName } = await extractExtension("/tmp/ext.zip");
if(error === "zip-error")
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for your submission! Sadly, we were unable to properly extract your extension from its zip file. Try to create the zip with another software, and to update your original submission post with the new file. If that still doesn't work, ask a member of the extension team for help 😉`
})
if(error === "too-many-files")
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for your submission! We are kind of confused; Your zip file contained more than one JSON file, and only one extension can be submitted at a time. Please update your original submission post with a new zip file containing only one extension file 🙏`
})
if(error === "no-json-found")
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for your submission! We are kind of confused; Your zip file doesn't seem to contain an extension. Please update your original submission post with a new zip file containing an extension 🙏\nIf your zip does already contain an extension, make sure your file ends with ".json", and that it is at the root of your zip file (not in a sub folder!), as otherwise it will be unrecognized and ignored by the system. If you've checked and nothing seems wrong with your zip, you can ask a member of the extension team for help 😉`
})
if(error === "invalid-file-name")
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for your submission! We are sorry, but the filename of the extension has unrecognized characters. Since filenames with weird character can cause all kinds of problems and security flaws, our system won't allow file names with other characters than normal latin upper- and lowercase characters or numbers. Additionally, the first character must be an uppercase character. Please update your original submission post with a new zip file containing your extension with another file name following those guidelines 🙏`
})
if(error) {
core.setFailed("Extraction of the extension failed!");
return;
}
const { code, errors } = await verifyExtension(extensionName, { preliminaryCheck: true });
if(code === "invalid-file-name")
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for your submission! We are sorry, but the filename of the extension has unrecognized characters. Since filenames with weird character can cause all kinds of problems and security flaws, our system won't allow file names with other characters than normal latin upper- and lowercase characters or numbers. Additionally, the first character must be an uppercase character. Please update your original submission post with a new zip file containing your extension with another file name following those guidelines 🙏`
})
if(code === "not-found")
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for your submission! We are sorry, but it seems your extension file miraculously disappeared just after being extracted 🤔. This should never happen, please ask @GDevelopApp/extensions-team for assistance.`
})
if(code === "duplicated" )
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for your submission! We are sorry, but it seems we already have a reviewed extension with that name. Extensions cannot be in both the community and reviewed extensions list at once. If you are trying to update that extension, please ask a member of the extension team for help. If the name clash is a coincidence, please update your original submission post with a new zip file containing your extension with a file name that is not already taken 🙏`
})
if(code === "invalid-json")
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for your submission! We are sorry, but your extension file inside the zip file seems to be damaged, as our system wasn't able to understand its content. Try to re-export the extension JSON file, or to create the zip with another software, and to update your original submission post with the new zip file. If that still doesn't work, ask a member of the extension team for help 😉`
})
if(code === "rule-break")
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for your submission! Unfortunately, all submitted extensions have to meet some minimal quality standard - the extension best practices - and our system has found that your extension does not fully comply 😔. You can find all of those rules on [the GDevelop wiki](https://wiki.gdevelop.io/gdevelop5/extensions/best-practices). \n\nThe following issues have been found by the system concerning the respect of those best practices by your extension: \n\`\`\`\n${errors.reduce((acc, error) => `${acc}\n ⟶ ❌ ${error}`, '').slice(1)}\n\`\`\`\nPlease update your original submission post with a new zip file containing your extensions updated to follow those guidelines 🙏`
})
if(code !== "success") core.setFailed("Verification of the extension failed!");
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
commit-message: 'Automated Extension submission for issue #${{ github.event.issue.number }}'
committer: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: extension/${{ github.actor }}/${{ github.event.issue.number }}
delete-branch: true
title: '${{ github.event.issue.title }}'
body: ${{ github.event.issue.body }}
labels: ✨ New extension
- name: Add card to pending review
uses: peter-evans/create-or-update-project-card@v2
with:
project-name: Extensions review
column-name: Needs review
issue-number: ${{ steps.cpr.outputs.pull-request-number }}
- name: Close and comment on issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue close ${{ github.event.issue.number }}
gh issue comment ${{ github.event.issue.number }} --body "Hi @${{ github.actor }}! 👋 This submission has passed all required tests, and has been moved to a PR as part of our submission pipeline. [You can see the progress of your submission on this page](${{ steps.cpr.outputs.pull-request-url }}). Community submissions are not reviewed by default, so your extension should be added once we've checked that your submission doesn't contain malicious code without further intervention on your part. If you wish for your extension to be reviewed (and thereby moved to the list of reviewed extensions), please follow the instructions written on the [README](https://github.com/GDevelopApp/GDevelop-extensions#get-your-extension-reviewed-extensions). Thanks again for your contribution to GDevelop!"