[BUG] Floating windows open behind tiled windows in overview #14
This file contains hidden or 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
| name: Label Issue Metadata | |
| on: | |
| issues: | |
| types: [opened, edited] | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| label-issue-metadata: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Apply distribution and session labels from issue form | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const issue = context.payload.issue; | |
| const body = issue.body || ""; | |
| const issueNumber = issue.number; | |
| const { owner, repo } = context.repo; | |
| const extractValue = (heading) => { | |
| const escapedHeading = heading.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | |
| const match = body.match(new RegExp(`^\\s*(?:###\\s*)?${escapedHeading}\\s*\\r?\\n+([^\\n\\r]+)`, "im")); | |
| return match ? match[1].trim() : null; | |
| }; | |
| const distributionValue = extractValue("Distribution"); | |
| const sessionValue = extractValue("Session type"); | |
| const distributionLabelMap = { | |
| "Arch-based": "arch-based", | |
| "Fedora-based": "fedora-based", | |
| "Debian-based": "debian-based", | |
| "Gentoo-based": "gentoo", | |
| "NixOS": "nixos", | |
| "openSUSE-based": "opensuse", | |
| "Void": "void", | |
| "Other": "distro:other" | |
| }; | |
| const sessionLabelMap = { | |
| "Native session (TTY or display manager)": "session:native", | |
| "Nested inside a Wayland session": "session:nested-wayland", | |
| "Nested inside an X11 session": "session:nested-x11", | |
| "Headless": "session:headless" | |
| }; | |
| const distributionLabels = new Set(Object.values(distributionLabelMap)); | |
| const sessionLabels = new Set(Object.values(sessionLabelMap)); | |
| const mappings = [ | |
| { | |
| kind: "distribution", | |
| selectedValue: distributionValue, | |
| labelMap: distributionLabelMap, | |
| managedLabels: distributionLabels, | |
| description: "Issue reported for this Linux distribution family" | |
| }, | |
| { | |
| kind: "session", | |
| selectedValue: sessionValue, | |
| labelMap: sessionLabelMap, | |
| managedLabels: sessionLabels, | |
| description: "Issue reported for this Umbriel session type" | |
| } | |
| ]; | |
| async function ensureLabelExists(name, description) { | |
| try { | |
| await github.rest.issues.getLabel({ owner, repo, name }); | |
| } catch (error) { | |
| if (error.status !== 404) throw error; | |
| await github.rest.issues.createLabel({ | |
| owner, | |
| repo, | |
| name, | |
| color: "5319e7", | |
| description | |
| }); | |
| core.info(`Created missing label "${name}".`); | |
| } | |
| } | |
| const existingLabels = issue.labels.map((label) => label.name); | |
| for (const mapping of mappings) { | |
| if (!mapping.selectedValue) { | |
| core.info(`${mapping.kind} field not found in issue body; skipping.`); | |
| continue; | |
| } | |
| const targetLabel = mapping.labelMap[mapping.selectedValue]; | |
| if (!targetLabel) { | |
| core.info(`No ${mapping.kind} label mapping found for value: "${mapping.selectedValue}"`); | |
| continue; | |
| } | |
| await ensureLabelExists(targetLabel, mapping.description); | |
| const currentKindLabels = existingLabels.filter((name) => mapping.managedLabels.has(name)); | |
| for (const label of currentKindLabels) { | |
| if (label === targetLabel) continue; | |
| try { | |
| await github.rest.issues.removeLabel({ | |
| owner, | |
| repo, | |
| issue_number: issueNumber, | |
| name: label | |
| }); | |
| } catch (error) { | |
| core.info(`Could not remove label "${label}": ${error.message}`); | |
| } | |
| } | |
| await github.rest.issues.addLabels({ | |
| owner, | |
| repo, | |
| issue_number: issueNumber, | |
| labels: [targetLabel] | |
| }); | |
| core.info(`Applied ${mapping.kind} label "${targetLabel}" from value "${mapping.selectedValue}".`); | |
| } |