Skip to content

Run Check service on Enter in the card service address #1425

Run Check service on Enter in the card service address

Run Check service on Enter in the card service address #1425

name: Pull request labels
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@b8dd2d9be0f68b860e7dae5dae7d772984eacd6d # v6
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true
- name: Apply size label
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: |
const labels = ['size:XS','size:S','size:M','size:L','size:XL'];
const colors = ['0e8a16','1d76db','fbca04','d93f0b','b60205'];
for (let i = 0; i < labels.length; i++) {
try { await github.rest.issues.getLabel({owner: context.repo.owner, repo: context.repo.repo, name: labels[i]}); }
catch { await github.rest.issues.createLabel({owner: context.repo.owner, repo: context.repo.repo, name: labels[i], color: colors[i]}); }
}
const pr = context.payload.pull_request;
const lines = pr.additions + pr.deletions;
const size = lines <= 10 ? labels[0] : lines <= 50 ? labels[1] : lines <= 200 ? labels[2] : lines <= 500 ? labels[3] : labels[4];
const current = (await github.rest.issues.listLabelsOnIssue({owner: context.repo.owner, repo: context.repo.repo, issue_number: pr.number})).data.map(x => x.name);
for (const name of current.filter(x => labels.includes(x) && x !== size)) await github.rest.issues.removeLabel({owner: context.repo.owner, repo: context.repo.repo, issue_number: pr.number, name});
if (!current.includes(size)) await github.rest.issues.addLabels({owner: context.repo.owner, repo: context.repo.repo, issue_number: pr.number, labels: [size]});
# actions/labeler with sync-labels writes back the whole label set it read
# at start, so it can wipe mira-paused if mira-pause.yml added it mid-run
# (#355). Re-apply it when the latest Mira command on the PR is a pause.
- name: Keep mira-paused after syncing labels
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;
const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number, per_page: 100 });
const commands = comments.map((c) => (c.body || '').trim()).filter((b) => /^\/mira (pause|resume)\b/.test(b));
if (!commands.length || !commands[commands.length - 1].startsWith('/mira pause')) return;
const current = (await github.rest.issues.listLabelsOnIssue({ owner, repo, issue_number })).data.map((x) => x.name);
if (!current.includes('mira-paused')) {
await github.rest.issues.addLabels({ owner, repo, issue_number, labels: ['mira-paused'] });
core.info('Re-applied mira-paused');
}