[Submit add-on]: subtitle_reader-3.50 #3393
This file contains hidden or 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: Send json file | |
| on: | |
| issues: | |
| types: | |
| - labeled | |
| jobs: | |
| check-addon: | |
| permissions: | |
| contents: write | |
| issues: write | |
| name: Check add-on | |
| if: github.event.label.name == 'autoSubmissionFromIssue' | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout datastore repo | |
| uses: actions/checkout@v5 | |
| with: | |
| path: datastore | |
| - name: Get data | |
| id: get-data | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const setOutputFromIssue = require('./datastore/.github/workflows/getData.js') | |
| setOutputFromIssue({context, core}) | |
| - name: Checkout validate repo | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: nvaccess/addon-datastore-validation | |
| submodules: true | |
| path: validation | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.13 | |
| - name: Create validation errors file | |
| run: echo "" > validationErrors.md | |
| - name: Download add-on | |
| env: | |
| # transfer user input to env variables | |
| # https://blog.gitguardian.com/github-actions-security-cheat-sheet/ | |
| url: ${{ steps.get-data.outputs.downloadUrl }} | |
| # wrap all user input in quotations to prevent RCE e.g. www.example.com/&rm -rf | |
| run: curl --location --output addon.nvda-addon "$env:url" 2>> validationErrors.md | |
| - name: Add extra message if curl fails to validation errors | |
| if: failure() | |
| run: echo "Error with downloading add-on from download URL" >> validationErrors.md | |
| - name: Create JSON submission from issue | |
| env: | |
| # transfer user input to env variables to escape any code | |
| # https://blog.gitguardian.com/github-actions-security-cheat-sheet/ | |
| 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 }} | |
| # wrap all user input in quotations to prevent RCE e.g. www.example.com/&rm -rf | |
| run: | | |
| validation/runcreatejson ` | |
| -f ..\addon.nvda-addon ` | |
| --dir ..\datastore\addons ` | |
| --output ..\validationErrors.md ` | |
| --channel=""$env:channel"" ` | |
| --publisher=""$env:publisher"" ` | |
| --sourceUrl=""$env:sourceUrl"" ` | |
| --url=""$env:url"" ` | |
| --licName=""$env:licName"" ` | |
| --licUrl=""$env:licUrl"" | |
| - name: Post validation errors as comment | |
| if: failure() | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| issue-number: ${{ github.event.issue.number }} | |
| body-file: ./validationErrors.md | |
| - name: Create branch | |
| id: cb | |
| env: | |
| branchName: ${{ github.event.issue.user.login }}${{ steps.get-data.outputs.issueNumber }} | |
| run: | | |
| cd datastore | |
| git config user.name github-actions | |
| git config user.email [email protected] | |
| git checkout -b ${{ env.branchName }} | |
| git add . | |
| git commit -m "Submit add-on" | |
| # Force push to the branch, as we may need to be handling a resubmission attempt | |
| git push -f origin ${{ env.branchName }} | |
| - name: Upload add-on | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: addon | |
| path: addon.nvda-addon | |
| - name: Install VirusTotal | |
| run: choco install vt-cli | |
| - name: Scan add-on with VirusTotal | |
| env: | |
| VT_API_KEY: ${{ secrets.VT_API_KEY }} | |
| run: vt scan file -k $env:VT_API_KEY addon.nvda-addon | |
| call-workflow: | |
| needs: check-addon | |
| uses: ./.github/workflows/checkAndSubmitAddonMetadata.yml | |
| with: | |
| issueNumber: "${{ github.event.issue.number }}" | |
| issueAuthorId: ${{ github.event.issue.user.id }} | |
| issueAuthorName: ${{ github.event.issue.user.login }} | |
| issueTitle: ${{ github.event.issue.title }} | |
| secrets: | |
| VT_API_KEY: ${{ secrets.VT_API_KEY }} |