forked from JeremyHeleine/Photo-Sphere-Viewer
-
-
Notifications
You must be signed in to change notification settings - Fork 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
130 additions
and
52 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,21 @@ jobs: | |
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
NPM_TAG: ${{ steps.npm_tag.outputs.NPM_TAG || 'latest' }} | ||
|
||
- uses: Akkjon/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
milestone_name: ${{ github.ref_name }} | ||
crash_on_missing: false | ||
|
||
- name: update issue templates | ||
run: | | ||
git fetch origin main --depth 1 | ||
git checkout main | ||
node ./build/update-issue-templates.mjs ${{ github.ref_name }} | ||
git stage .github/ISSUE_TEMPLATE | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "github-actions" | ||
git commit -m "chore: add ${{ github.ref_name }} to issue templates" | ||
git push |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* Add the version provided as first parameter to the options of the issue templates | ||
*/ | ||
|
||
import fs from 'fs'; | ||
import yaml from 'yaml'; | ||
|
||
const VERSION = process.argv[2]; | ||
const MAX_VERSIONS = 10; | ||
const OTHER_LABEL = 'other'; | ||
|
||
if (!VERSION) { | ||
console.warn('No version provided'); | ||
process.exit(0); | ||
} | ||
|
||
[ | ||
'.github/ISSUE_TEMPLATE/bug_report.yml', | ||
'.github/ISSUE_TEMPLATE/support_request.yml', | ||
] | ||
.forEach(filename => { | ||
if (!fs.existsSync(filename)) { | ||
console.warn(`${filename} does not exists`); | ||
return; | ||
} | ||
|
||
const content = yaml.parse(fs.readFileSync(filename, { encoding: 'utf8' })); | ||
|
||
const item = content.body.find(({ id }) => id === 'version'); | ||
if (!item) { | ||
console.warn(`Dropdown not found in ${filename}`); | ||
return; | ||
} | ||
|
||
const versions = item.attributes.options.filter(v => v !== OTHER_LABEL); | ||
if (versions.indexOf(VERSION) !== -1) { | ||
console.warn(`Version ${VERSION} already exists in ${filename}`); | ||
return; | ||
} | ||
|
||
console.log(`Add ${VERSION} in ${filename}`); | ||
versions.unshift(VERSION); | ||
if (versions.length > MAX_VERSIONS) { | ||
versions.splice(MAX_VERSIONS, versions.length - MAX_VERSIONS); | ||
} | ||
versions.push(OTHER_LABEL); | ||
|
||
item.attributes.options = versions; | ||
|
||
fs.writeFileSync(filename, yaml.stringify(content, { lineWidth: 0 })); | ||
}); |
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