Requesting repo for solar2d-plugin_screen_recorder #19
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: Create Repo Request | |
on: | |
issues: | |
types: labeled | |
jobs: | |
create-repo: | |
if: github.event.label.name == 'approved' | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: Write template instead of checking out whole repo | |
uses: DamianReeves/[email protected] | |
with: | |
path: ./new_plugin.yml | |
write-mode: overwrite | |
contents: | | |
body: | |
- type: textarea | |
id: description | |
attributes: | |
label: Plugin description | |
- type: input | |
id: publisherId | |
attributes: | |
label: Desired publisher Id | |
- type: input | |
id: pluginName | |
attributes: | |
label: Your plugin name | |
- type: checkboxes | |
id: terms | |
attributes: | |
label: Terms and conditions | |
- uses: stefanbuck/github-issue-parser@v3 | |
id: issue-parser | |
with: | |
template-path: ./new_plugin.yml | |
- run: | | |
if [ -z "${{ steps.issue-parser.outputs.issueparser_publisherId }}" ] | |
then | |
echo "Requires publisheriD" | |
exit 1 | |
fi | |
if [ -z "${{ steps.issue-parser.outputs.issueparser_pluginName }}" ] | |
then | |
echo "Requires plugin name" | |
exit 1 | |
fi | |
- uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.REPOS_PAT}} | |
script: | | |
await github.rest.repos.createUsingTemplate({ | |
template_owner: "solar2d", | |
template_repo: "plugin-template", | |
name: "${{ steps.issue-parser.outputs.issueparser_publisherId }}-${{ steps.issue-parser.outputs.issueparser_pluginName }}", | |
owner: "solar2d" | |
}); | |
await github.request('PUT /repos/solar2d/${{ steps.issue-parser.outputs.issueparser_publisherId }}-${{ steps.issue-parser.outputs.issueparser_pluginName }}/collaborators/${{ github.event.issue.user.login }}', { | |
permission: 'push' | |
}) | |
- name: Close Issue | |
uses: peter-evans/close-issue@v2 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
comment: | | |
Done! | |
Created repo https://github.com/solar2d/${{ steps.issue-parser.outputs.issueparser_publisherId }}-${{ steps.issue-parser.outputs.issueparser_pluginName }} | |