Skip to content

README: Update link to https://primer.style/view_components/ #2849

README: Update link to https://primer.style/view_components/

README: Update link to https://primer.style/view_components/ #2849

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@v4
with:
sync-labels: true
repo-token: "${{ secrets.GITHUB_TOKEN }}"
check-for-changeset:
name: Check for changeset
runs-on: ubuntu-latest
env:
SKIP_LABEL: "skip changelog"
if: "!contains(github.event.pull_request.labels.*.name, 'skip changelog')"
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Check for changeset"
run: script/check-for-changeset
semver-label:
if: ${{ github.repository == 'primer/view_components' }}
name: semver label
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
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(/^\+['"]@primer\/view-components['"]:\s(patch|minor|major)/mg)]
if (match && match[0]) {
return match[0][1]
}
- uses: actions/github-script@v6
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]
})
}