Skip to content

Add Text File Extension to package.json #34

Add Text File Extension to package.json

Add Text File Extension to package.json #34

name: Add Text File Extension to package.json
concurrency:
group: add-text-file-extension
permissions:
contents: write
issues: write
on:
workflow_dispatch:
inputs:
publish-release:
type: boolean
default: false
description: Whether to trigger package.yml after updating files.
required: true
bump-package-version:
type: boolean
default: true
description: Whether to bump the third portion of the package version by one.
required: true
file-extensions:
type: string
required: true
description: A comma separated list of file extensions to add to ext.json
should-close-issue:
type: boolean
required: false
default: false
description: Is there an issue that adding this extension should close?
issue-to-close:
type: string
required: false
description: The id of the issue this should close.
jobs:
modify-files:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Modify ext.json
run: |
npm i
node ./.github/actions-scripts/modify-ext.json.js -e "${{inputs.file-extensions}}"
- name: Bump Package Version (Optional)
if: inputs.bump-package-version
run: node ./.github/actions-scripts/bump-package-version-rev.js
- name: Save Changes to GitHub
run: |
git pull
git config user.name github-actions
git config user.email "[email protected]"
git add .
git commit -m "Add file extension(s) to ext.json: ${{inputs.file-extensions}}"${{inputs.bump-package-version && ' -m "Bump package version [rev]"' || ''}}${{inputs.should-close-issue && ' -m "Closes #' || ''}}${{inputs.should-close-issue && inputs.issue-to-close || ''}}${{inputs.should-close-issue && '"' || ''}}
git push
- name: Create comment
uses: peter-evans/create-or-update-comment@v4
if: inputs.should-close-issue
with:
issue-number: ${{ inputs.issue-to-close }}
body: |
The file extension(s) `${{inputs.file-extensions}}` has been added to the list of text files.
${{inputs.publish-release && 'This actions run has also been instructed to publish the extension. Your requested fix should appear in the next release, so make sure to update your extension. (The release process usually takes 5-15 minutes.)' || ''}}
# reactions: '+1'
publish:
if: inputs.publish-release
needs: modify-files
uses: ./.github/workflows/package.yml
with:
preRelease: false
secrets:
AZURE_PAT: ${{secrets.AZURE_PAT}}
OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }}