feat(refine): round compatible ordinary bar charts #1193
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: PR Feature Label | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize, reopened] | |
| jobs: | |
| label: | |
| runs-on: ubuntu-latest | |
| # Skip fork PRs (read-only token can't label) and dependabot — matches repo convention | |
| if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' | |
| permissions: | |
| issues: write # create the label if it doesn't exist yet | |
| pull-requests: write # add the label to the PR | |
| steps: | |
| - uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const prefix = 'feature/'; | |
| const pr = context.payload.pull_request; | |
| // Label whichever side of the PR is a feature branch: | |
| // - base is feature/* : a PR merging INTO a long-lived feature branch | |
| // - head is feature/* : a feature branch being merged into main (or elsewhere) | |
| // Both produce a "feature:<name>" label; if both sides qualify, both are applied. | |
| const labels = [...new Set( | |
| [pr.base.ref, pr.head.ref] | |
| .filter((ref) => ref.startsWith(prefix)) | |
| .map((ref) => `feature:${ref.slice(prefix.length)}`) | |
| )]; | |
| if (labels.length === 0) { | |
| console.log(`Neither base "${pr.base.ref}" nor head "${pr.head.ref}" is a feature branch; nothing to do.`); | |
| return; | |
| } | |
| // Create any labels that don't exist yet (auto-created gray). | |
| for (const label of labels) { | |
| try { | |
| await github.rest.issues.getLabel({ ...context.repo, name: label }); | |
| } catch (error) { | |
| if (error.status === 404) { | |
| await github.rest.issues.createLabel({ ...context.repo, name: label, color: 'ededed' }); | |
| console.log(`Created label "${label}"`); | |
| } else { | |
| throw error; | |
| } | |
| } | |
| } | |
| await github.rest.issues.addLabels({ | |
| ...context.repo, | |
| issue_number: pr.number, | |
| labels, | |
| }); | |
| console.log(`Applied label(s) ${labels.map((l) => `"${l}"`).join(', ')} to PR #${pr.number}`); |