Skip to content

Commit

Permalink
Add extra fields
Browse files Browse the repository at this point in the history
Use NV Access repositories
  • Loading branch information
feerrenrut committed Jul 22, 2022
1 parent b2401be commit 12e5af0
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 27 deletions.
41 changes: 33 additions & 8 deletions .github/ISSUE_TEMPLATE/registerAddon.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Addon registration
description: Add an NVDA add-on to addons-datastore
name: Add-on registration
description: Add an NVDA add-on to add-ons datastore
title: "[Submit add-on]: "
labels: [enhancement]
assignees:
- nvaccess
body:
# Docs on using issue forms:
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- type: markdown
attributes:
value: |
Expand All @@ -13,8 +15,16 @@ body:
id: download-url
attributes:
label: Download URL
description: The URL to download the add-on. It must start with https and end with -nvda-addon.
placeholder: https://github.com/username/addon/releases/releaseNumber/download/addonName.nvda-addon
description: The URL to download the add-on. It must start with 'https' and end with 'nvda-addon'.
placeholder: https://github.com/userName/addonName/releases/releaseNumber/download/addonName.nvda-addon
validations:
required: true
- type: input
id: publisher
attributes:
label: Publisher
description: The author of the addon (individual, group name, or organisation).
placeholder: Author Name
validations:
required: true
- type: input
Expand All @@ -25,11 +35,26 @@ body:
placeholder: https://github.com/username/repo/
validations:
required: true
- type: checkboxes
- type: dropdown
id: channel
attributes:
label: Channel
description: Channel for this release (maybe stable or beta)
description: Channel for this add-on release.
multiple: false
options:
- label: This is a stable release
required: false
- stable
- beta
validations:
required: true
- type: input
id: license-name
attributes:
label: License Name
description: What license is this add-on released under?
value: GPL v2
- type: input
id: license-url
attributes:
label: License URL
description: What is the URL to allow reading the license is this add-on released under?
value: https://www.gnu.org/licenses/gpl-2.0.html
54 changes: 35 additions & 19 deletions .github/workflows/sendJsonFile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,49 @@ jobs:
uses: actions/github-script@v5
with:
script: |
const title = context.payload.issue.title
core.setOutput('title', title)
const number = "#" + context.payload.issue.number
core.setOutput('number', number)
// Allow identifying the issue later.
// setOutput exposes the variable for access at later stages via steps.get-data.outputs
//
const issueTitle = context.payload.issue.title
core.setOutput('issueTitle', issueTitle)
const issueNumber = "#" + context.payload.issue.number
core.setOutput('issueNumber', issueNumber)
// Knowing the submitter may be helpful
// const issueSubmitter = context.payload.sender.login
//
// Field headers, Md == Markdown
const header3Prefix = "###"
const dlTitleMd = "### Download URL"
const sourceUrlMd = "### Source URL"
const channelMd = "### Channel"
const licenseMd = "### License Name"
const licenseUrlMd = "### License URL"
const publisherMd = "### Publisher"
//
// collect variables from issue form
//
const body = context.payload.issue.body
const downloadUrl = body.split("### Download URL")[1].split("###")[0].trim()
const downloadUrl = body.split(dlTitleMd)[1].split(header3Prefix)[0].trim()
core.setOutput('downloadUrl', downloadUrl)
const sourceUrl = body.split("### Source URL")[1].split("###")[0].trim()
const sourceUrl = body.split(sourceUrlMd)[1].split(header3Prefix)[0].trim()
core.setOutput('sourceUrl', sourceUrl)
const releaseChannel = body.split("### Channel")[1].split("###")[0].trim()
if (releaseChannel === "- [x] This is a stable release") {
channel = "stable"
} else {
channel = "beta"
}
core.setOutput('channel', channel)
const publisher = context.payload.sender.login
const releaseChannel = body.split(channelMd)[1].split(header3Prefix)[0].trim()
core.setOutput('releaseChannel', releaseChannel)
const publisher = body.split(publisherMd)[1].split(header3Prefix)[0].trim()
core.setOutput('publisher', publisher)
const licenseName = body.split(licenseMd)[1].split(header3Prefix)[0].trim()
core.setOutput('licenseName', licenseName)
const licenseUrl = body.split(licenseUrlMd)[1].split(header3Prefix)[0].trim()
core.setOutput('licenseUrl', licenseUrl)
- name: Checkout validate repo
uses: actions/checkout@v2
with:
repository: nvdaes/addon-datastore-validation
repository: nvaccess/addon-datastore-validation
submodules: true
- name: Checkout datastore repo
uses: actions/checkout@v2
with:
repository: nvdaes/addon-datastore
repository: nvaccess/addon-datastore
path: datastore
- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand All @@ -52,16 +68,16 @@ jobs:
- name: Download add-on
run: curl --location --output addon.nvda-addon ${{ steps.get-data.outputs.downloadUrl }}
- name: Create json file
run: runcreatejson addon.nvda-addon datastore/addons ${{ steps.get-data.outputs.channel }} ${{ steps.get-data.outputs.publisher }} ${{ steps.get-data.outputs.sourceUrl }} ${{ steps.get-data.outputs.downloadUrl }}
run: runcreatejson -f addon.nvda-addon --dir datastore/addons --channel=${{ steps.get-data.outputs.releaseChannel }} --publisher=${{ steps.get-data.outputs.publisher }} --sourceUrl=${{ steps.get-data.outputs.sourceUrl }} --url=${{ steps.get-data.outputs.downloadUrl }} --licName=${{ steps.get-data.outputs.licenseName }} --licUrl=${{ steps.get-data.outputs.licenseUrl }}
shell: cmd
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{secrets.PR_TOKEN }}
path: datastore
commit-message: ${{ steps.get-data.outputs.title }}
body: Closes issue ${{ steps.get-data.outputs.number }}
commit-message: ${{ steps.get-data.outputs.issueTitle }}
body: Closes issue ${{ steps.get-data.outputs.issueNumber }}
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v1
Expand Down

0 comments on commit 12e5af0

Please sign in to comment.