issue-opened.yml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. name: Issue Opened
  2. on:
  3. issues:
  4. types:
  5. - opened
  6. permissions: {}
  7. jobs:
  8. add-to-issue-triage:
  9. if: ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }}
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Generate GitHub App token
  13. uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
  14. id: generate-token
  15. with:
  16. creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
  17. org: electron
  18. - name: Add to Issue Triage
  19. uses: dsanders11/project-actions/add-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
  20. with:
  21. field: Reporter
  22. field-value: ${{ github.event.issue.user.login }}
  23. project-number: 90
  24. token: ${{ steps.generate-token.outputs.token }}
  25. set-labels:
  26. if: ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }}
  27. runs-on: ubuntu-latest
  28. steps:
  29. - name: Generate GitHub App token
  30. uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
  31. id: generate-token
  32. with:
  33. creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
  34. org: electron
  35. - run: npm install @electron/[email protected] [email protected] [email protected] [email protected]
  36. - name: Add labels
  37. uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
  38. id: add-labels
  39. env:
  40. ISSUE_BODY: ${{ github.event.issue.body }}
  41. with:
  42. github-token: ${{ steps.generate-token.outputs.token }}
  43. script: |
  44. const { fromMarkdown } = await import('${{ github.workspace }}/node_modules/mdast-util-from-markdown/index.js');
  45. const { select } = await import('${{ github.workspace }}/node_modules/unist-util-select/index.js');
  46. const semver = await import('${{ github.workspace }}/node_modules/semver/index.js');
  47. const [ owner, repo ] = '${{ github.repository }}'.split('/');
  48. const issue_number = ${{ github.event.issue.number }};
  49. const tree = fromMarkdown(process.env.ISSUE_BODY);
  50. const labels = [];
  51. const electronVersion = select('heading:has(> text[value="Electron Version"]) + paragraph > text', tree)?.value.trim();
  52. if (electronVersion !== undefined) {
  53. const major = semver.parse(electronVersion)?.major;
  54. if (major) {
  55. const versionLabel = `${major}-x-y`;
  56. let labelExists = false;
  57. try {
  58. await github.rest.issues.getLabel({
  59. owner,
  60. repo,
  61. name: versionLabel,
  62. });
  63. labelExists = true;
  64. } catch {}
  65. if (labelExists) {
  66. // Check if it's an unsupported major
  67. const { ElectronVersions } = await import('${{ github.workspace }}/node_modules/@electron/fiddle-core/dist/index.js');
  68. const versions = await ElectronVersions.create(undefined, { ignoreCache: true });
  69. if (!versions.supportedMajors.includes(major)) {
  70. core.setOutput('unsupportedMajor', true);
  71. labels.push('blocked/need-info ❌');
  72. }
  73. labels.push(versionLabel);
  74. }
  75. }
  76. }
  77. const operatingSystems = select('heading:has(> text[value="What operating system(s) are you using?"]) + paragraph > text', tree)?.value.trim().split(', ');
  78. const platformLabels = new Set();
  79. for (const operatingSystem of (operatingSystems ?? [])) {
  80. switch (operatingSystem) {
  81. case 'Windows':
  82. platformLabels.add('platform/windows');
  83. break;
  84. case 'macOS':
  85. platformLabels.add('platform/macOS');
  86. break;
  87. case 'Ubuntu':
  88. case 'Other Linux':
  89. platformLabels.add('platform/linux');
  90. break;
  91. }
  92. }
  93. if (platformLabels.size === 3) {
  94. labels.push('platform/all');
  95. } else {
  96. labels.push(...platformLabels);
  97. }
  98. const gistUrl = select('heading:has(> text[value="Testcase Gist URL"]) + paragraph > text', tree)?.value.trim();
  99. if (gistUrl !== undefined && gistUrl.startsWith('https://gist.github.com/')) {
  100. labels.push('has-repro-gist');
  101. }
  102. if (labels.length) {
  103. await github.rest.issues.addLabels({
  104. owner,
  105. repo,
  106. issue_number,
  107. labels,
  108. });
  109. }
  110. - name: Create unsupported major comment
  111. if: ${{ steps.add-labels.outputs.unsupportedMajor }}
  112. uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
  113. with:
  114. actions: 'create-comment'
  115. token: ${{ steps.generate-token.outputs.token }}
  116. body: |
  117. <!-- end-of-life -->
  118. Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
  119. 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.
  120. 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.