Skip to content

fix(manager): bypass typed routes check for dashboard redirect #1278

fix(manager): bypass typed routes check for dashboard redirect

fix(manager): bypass typed routes check for dashboard redirect #1278

Workflow file for this run

name: issue-labels
permissions:
issues: write
pull-requests: write
on:
issues:
types: [opened, edited]
pull_request:
types: [opened, edited]
jobs:
issue-label:
runs-on: ubuntu-latest
if: github.event_name == 'issues' && (github.event.action == 'opened' || (github.event.action == 'edited' && (github.event.changes.title || github.event.changes.body)))
steps:
- name: Apply labels and assignee from title
uses: actions/github-script@v8
with:
script: |
const title = context.payload.issue?.title || '';
const match = title.match(/^(feat|fix|chore|docs)\(([^)]+)\):/);
if (!match) return;
const [, type, scope] = match;
const validTypes = ['feat', 'fix', 'chore', 'docs'];
const validScopes = ['web', 'cms', 'mobile', 'graphql', 'tooling'];
if (!validTypes.includes(type) || !validScopes.includes(scope)) return;
const labelsToAdd = [type, scope];
const issue = context.payload.issue;
const existingLabels = issue.labels.map(l => l.name);
const toAdd = labelsToAdd.filter(l => !existingLabels.includes(l));
if (toAdd.length) {
await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, labels: toAdd });
}
if (context.payload.action === 'opened') {
const creator = context.payload.issue?.user?.login;
if (creator) {
await github.rest.issues.addAssignees({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, assignees: [creator] });
}
}
pr-label:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && (github.event.action == 'opened' || (github.event.action == 'edited' && github.event.changes.title))
steps:
- name: Apply labels and assignee from PR title
uses: actions/github-script@v8
with:
script: |
const title = context.payload.pull_request?.title || '';
const match = title.match(/^(feat|fix|chore|docs)\(([^)]+)\):/);
if (!match) return;
const [, type, scope] = match;
const validTypes = ['feat', 'fix', 'chore', 'docs'];
const validScopes = ['web', 'cms', 'mobile', 'graphql', 'tooling'];
if (!validTypes.includes(type) || !validScopes.includes(scope)) return;
const labelsToAdd = [type, scope];
const pr = context.payload.pull_request;
const existingLabels = pr.labels.map(l => l.name);
const toAdd = labelsToAdd.filter(l => !existingLabels.includes(l));
if (toAdd.length) {
await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: pr.number, labels: toAdd });
}
if (context.payload.action === 'opened') {
const author = context.payload.pull_request?.user?.login;
if (author) {
await github.rest.issues.addAssignees({ owner: context.repo.owner, repo: context.repo.repo, issue_number: pr.number, assignees: [author] });
}
}