feat: Hide unused player buttons and show subtitle state #238
Workflow file for this run
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: Auto-label platform | |
| on: | |
| issues: | |
| types: [opened, edited] | |
| pull_request_target: | |
| types: [opened, edited] | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| label: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Apply platform labels | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const isIssue = !!context.payload.issue; | |
| const body = isIssue | |
| ? context.payload.issue.body || '' | |
| : context.payload.pull_request.body || ''; | |
| const number = isIssue | |
| ? context.payload.issue.number | |
| : context.payload.pull_request.number; | |
| const hasTizen = /Tizen/i.test(body); | |
| const hasWebOS = /webOS/i.test(body); | |
| const currentLabels = isIssue | |
| ? (context.payload.issue.labels || []).map(l => l.name) | |
| : (context.payload.pull_request.labels || []).map(l => l.name); | |
| const addLabels = []; | |
| const removeLabels = []; | |
| if (hasTizen && !currentLabels.includes('Tizen')) addLabels.push('Tizen'); | |
| if (!hasTizen && currentLabels.includes('Tizen')) removeLabels.push('Tizen'); | |
| if (hasWebOS && !currentLabels.includes('webOS')) addLabels.push('webOS'); | |
| if (!hasWebOS && currentLabels.includes('webOS')) removeLabels.push('webOS'); | |
| const labelFn = isIssue | |
| ? { add: 'addLabels', remove: 'removeLabel', owner: context.repo.owner, repo: context.repo.repo, issue_number: number } | |
| : { add: 'addLabels', remove: 'removeLabel', owner: context.repo.owner, repo: context.repo.repo, issue_number: number }; | |
| if (addLabels.length) { | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: number, | |
| labels: addLabels | |
| }); | |
| } | |
| for (const label of removeLabels) { | |
| try { | |
| await github.rest.issues.removeLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: number, | |
| name: label | |
| }); | |
| } catch (e) { | |
| // Label might not exist yet | |
| } | |
| } |