Skip to content

[59233] update subheader primer component to accept custom actions on the left edge #647

[59233] update subheader primer component to accept custom actions on the left edge

[59233] update subheader primer component to accept custom actions on the left edge #647

Workflow file for this run

name: Triage
on:
pull_request:
types:
# On by default if you specify no types.
- "opened"
- "reopened"
- "synchronize"
# For `skip-label` only.
- "labeled"
- "unlabeled"
permissions:
contents: read
pull-requests: write
issues: write
jobs:
label:
name: Labeler
if: github.event.action != 'labeled' && github.event.action != 'unlabeled'
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
sync-labels: true
repo-token: "${{ secrets.GITHUB_TOKEN }}"
check-for-changeset:
name: Check for changeset
runs-on: ubuntu-latest
env:
SKIP_LABEL: "skip changeset"
steps:
- if: "contains(github.event.pull_request.labels.*.name, 'skip changeset')"
run: echo "passed"; exit 0;
- if: "!contains(github.event.pull_request.labels.*.name, 'skip changeset')"
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- if: "!contains(github.event.pull_request.labels.*.name, 'skip changeset')"
name: "Check for changeset"
run: script/check-for-changeset
semver-label:
if: ${{ github.repository == 'opf/primer_view_components' }}
name: semver label
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
id: version-result
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
result-encoding: string
script: |
const diff_url = context.payload.pull_request.diff_url
const result = await github.request(diff_url)
const match = [...result.data.matchAll(/^\+['"]@openproject\/primer-view-components['"]:\s(patch|minor|major)/mg)]
if (match && match[0]) {
return match[0][1]
}
- uses: actions/github-script@v7
env:
RELEASE: ${{ steps.version-result.outputs.result }}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
if (process.env.RELEASE == 'undefined') { return }
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
})
const currentLabels = issue.data.labels.map( l => l.name)
const newLabel = `${process.env.RELEASE} release`
if (!currentLabels.includes(newLabel)) {
const otherReleaseLabels = currentLabels.filter( l => l.endsWith(' release'))
if (otherReleaseLabels.length) {
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: [otherReleaseLabels]
})
}
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [newLabel]
})
}