Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to send metadata from issues #37

Merged
merged 15 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/ISSUE_TEMPLATE/registerAddon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Add-on registration
description: Add an NVDA add-on to add-ons datastore
title: "[Submit add-on]: "
labels: [enhancement]
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
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: |
Submit an NVDA add-on to datastore. Provide download and source URL, and indicate if it's a stable add-on or not.
- type: input
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'.
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
placeholder: https://github.com/userName/addonName/releases/releaseNumber/download/addonName.nvda-addon
validations:
required: true
- type: input
id: source-url
attributes:
label: Source URL
description: The URL to review the source code of the submitted add-on.
placeholder: https://github.com/username/repo/
validations:
required: true
- type: dropdown
id: channel
attributes:
label: Channel
description: Channel for this add-on release.
multiple: false
options:
- stable
- beta
- dev
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?
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
value: https://www.gnu.org/licenses/gpl-2.0.html
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
93 changes: 93 additions & 0 deletions .github/workflows/sendJsonFile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Send json file
seanbudd marked this conversation as resolved.
Show resolved Hide resolved

on:
issues:
types:
- opened
- reopened
- edited

jobs:
check-addon:
name: Check add-on
runs-on: windows-latest
steps:
- name: Get data
id: get-data
uses: actions/github-script@v6
with:
script: |
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
// Allow identifying the issue later.
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
// 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"
//
// collect variables from issue form
//
const body = context.payload.issue.body
const downloadUrl = body.split(dlTitleMd)[1].split(header3Prefix)[0].trim()
core.setOutput('downloadUrl', downloadUrl)
const sourceUrl = body.split(sourceUrlMd)[1].split(header3Prefix)[0].trim()
core.setOutput('sourceUrl', sourceUrl)
const releaseChannel = body.split(channelMd)[1].split(header3Prefix)[0].trim()
core.setOutput('releaseChannel', releaseChannel)
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@v3
with:
repository: nvaccess/addon-datastore-validation
submodules: true
path: validation
- name: Checkout datastore repo
uses: actions/checkout@v3
with:
repository: nvdaes/addon-datastore
ref: master
path: datastore
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Download add-on
run: curl --location --output addon.nvda-addon ${{ steps.get-data.outputs.downloadUrl }}
- name: Create json file
run: |
validation\runcreatejson -f addon.nvda-addon --dir datastore\addons --channel=${{ steps.get-data.outputs.releaseChannel }} --publisher=${{ github.event.sender.login }} --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@v4
with:
token: ${{secrets.PR_ACCESS_TOKEN }}
path: datastore
title: ${{ steps.get-data.outputs.issueTitle }}
branch: ${{ github.event.sender.login }}${{ steps.get-data.outputs.issueNumber }}
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@v2
with:
token: ${{ secrets.PR_ACCESS_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
- name: Close Issue
uses: peter-evans/close-issue@v2
with:
issue-number: ${{ steps.get-data.outputs.issueNumber }}
comment: Auto-closing issue