ci: auto label bug issues with version label (#42044)
This commit is contained in:
parent
c765d57265
commit
188196e78c
1 changed files with 24 additions and 1 deletions
25
.github/workflows/issue-opened.yml
vendored
25
.github/workflows/issue-opened.yml
vendored
|
@ -35,7 +35,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||||
org: electron
|
org: electron
|
||||||
- run: npm install mdast-util-from-markdown@2.0.0 unist-util-select@5.1.0
|
- run: npm install mdast-util-from-markdown@2.0.0 unist-util-select@5.1.0 semver@7.6.0
|
||||||
- name: Add labels
|
- name: Add labels
|
||||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||||
env:
|
env:
|
||||||
|
@ -45,6 +45,7 @@ jobs:
|
||||||
script: |
|
script: |
|
||||||
const { fromMarkdown } = await import('${{ github.workspace }}/node_modules/mdast-util-from-markdown/index.js');
|
const { fromMarkdown } = await import('${{ github.workspace }}/node_modules/mdast-util-from-markdown/index.js');
|
||||||
const { select } = await import('${{ github.workspace }}/node_modules/unist-util-select/index.js');
|
const { select } = await import('${{ github.workspace }}/node_modules/unist-util-select/index.js');
|
||||||
|
const semver = await import('${{ github.workspace }}/node_modules/semver/index.js');
|
||||||
|
|
||||||
const [ owner, repo ] = '${{ github.repository }}'.split('/');
|
const [ owner, repo ] = '${{ github.repository }}'.split('/');
|
||||||
const issue_number = ${{ github.event.issue.number }};
|
const issue_number = ${{ github.event.issue.number }};
|
||||||
|
@ -53,6 +54,28 @@ jobs:
|
||||||
|
|
||||||
const labels = [];
|
const labels = [];
|
||||||
|
|
||||||
|
const electronVersion = select('heading:has(> text[value="Electron Version"]) + paragraph > text', tree)?.value.trim();
|
||||||
|
if (electronVersion !== undefined) {
|
||||||
|
const major = semver.parse(electronVersion)?.major;
|
||||||
|
if (major) {
|
||||||
|
const versionLabel = `${major}-x-y`;
|
||||||
|
let labelExists = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await github.rest.issues.getLabel({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
name: versionLabel,
|
||||||
|
});
|
||||||
|
labelExists = true;
|
||||||
|
} catch {}
|
||||||
|
|
||||||
|
if (labelExists) {
|
||||||
|
labels.push(versionLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const gistUrl = select('heading:has(> text[value="Testcase Gist URL"]) + paragraph > text', tree)?.value.trim();
|
const gistUrl = select('heading:has(> text[value="Testcase Gist URL"]) + paragraph > text', tree)?.value.trim();
|
||||||
if (gistUrl !== undefined && gistUrl.startsWith('https://gist.github.com/')) {
|
if (gistUrl !== undefined && gistUrl.startsWith('https://gist.github.com/')) {
|
||||||
labels.push('has-repro-gist');
|
labels.push('has-repro-gist');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue