2023-09-28 15:26:04 +00:00
name : Issue Opened
on :
issues :
types :
- opened
permissions : {}
jobs :
add-to-issue-triage :
if : ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }}
runs-on : ubuntu-latest
steps :
- name : Generate GitHub App token
uses : electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id : generate-token
with :
creds : ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org : electron
- name : Add to Issue Triage
2024-05-23 09:14:23 +00:00
uses : dsanders11/project-actions/add-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
2023-09-28 15:26:04 +00:00
with :
field : Reporter
field-value : ${{ github.event.issue.user.login }}
project-number : 90
token : ${{ steps.generate-token.outputs.token }}
2024-03-21 14:22:14 +00:00
set-labels :
if : ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }}
runs-on : ubuntu-latest
steps :
- name : Generate GitHub App token
uses : electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id : generate-token
with :
creds : ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org : electron
2024-07-15 19:25:47 +00:00
- run : npm install @electron/fiddle-core@1.3.3 mdast-util-from-markdown@2.0.0 unist-util-select@5.1.0 semver@7.6.0
2024-03-21 14:22:14 +00:00
- name : Add labels
uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
2024-07-15 19:25:47 +00:00
id : add-labels
2024-03-27 16:50:55 +00:00
env :
ISSUE_BODY : ${{ github.event.issue.body }}
2024-03-21 14:22:14 +00:00
with :
github-token : ${{ steps.generate-token.outputs.token }}
script : |
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');
2024-05-13 08:49:23 +00:00
const semver = await import('${{ github.workspace }}/node_modules/semver/index.js');
2024-03-21 14:22:14 +00:00
const [ owner, repo ] = '${{ github.repository }}'.split('/');
const issue_number = ${{ github.event.issue.number }};
2024-03-27 16:50:55 +00:00
const tree = fromMarkdown(process.env.ISSUE_BODY);
2024-03-21 14:22:14 +00:00
const labels = [];
2024-05-13 08:49:23 +00:00
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) {
2024-07-15 19:25:47 +00:00
// Check if it's an unsupported major
const { ElectronVersions } = await import('${{ github.workspace }}/node_modules/@electron/fiddle-core/dist/index.js');
const versions = await ElectronVersions.create(undefined, { ignoreCache: true });
if (!versions.supportedMajors.includes(major)) {
core.setOutput('unsupportedMajor', true);
labels.push('blocked/need-info ❌');
}
2024-05-13 08:49:23 +00:00
labels.push(versionLabel);
}
}
}
2024-08-05 13:52:49 +00:00
const operatingSystems = select('heading:has(> text[value="What operating system(s) are you using?"]) + paragraph > text', tree)?.value.trim().split(', ');
const platformLabels = new Set();
for (const operatingSystem of (operatingSystems ?? [])) {
switch (operatingSystem) {
case 'Windows' :
platformLabels.add('platform/windows');
break;
case 'macOS' :
platformLabels.add('platform/macOS');
break;
case 'Ubuntu' :
case 'Other Linux' :
platformLabels.add('platform/linux');
break;
}
}
if (platformLabels.size === 3) {
labels.push('platform/all');
} else {
labels.push(...platformLabels);
}
2024-03-21 14:22:14 +00:00
const gistUrl = select('heading:has(> text[value="Testcase Gist URL"]) + paragraph > text', tree)?.value.trim();
if (gistUrl !== undefined && gistUrl.startsWith('https://gist.github.com/')) {
labels.push('has-repro-gist');
}
if (labels.length) {
await github.rest.issues.addLabels({
owner,
repo,
issue_number,
labels,
});
}
2024-07-15 19:25:47 +00:00
- name : Create unsupported major comment
if : ${{ steps.add-labels.outputs.unsupportedMajor }}
uses : actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
with :
actions : 'create-comment'
token : ${{ steps.generate-token.outputs.token }}
body : |
<!-- end-of-life -->
Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
The version of Electron reported in this issue has reached end-of-life and is [no longer supported](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline). If you're still experiencing this issue on a [supported version](https://www.electronjs.org/releases/stable) of Electron, please update this issue to reflect that version of Electron.
Now adding the https://github.com/electron/electron/labels/blocked%2Fneed-info%20%E2%9D%8C label for this reason. This issue will be closed in 10 days if the above is not addressed.