deps-dev(deps-dev): Bump globals from 16.3.0 to 16.4.0 #94
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 Validation | |
on: | |
pull_request: | |
types: [opened, edited, synchronize, reopened] | |
pull_request_target: | |
types: [opened, edited, synchronize, reopened] | |
permissions: | |
contents: read | |
pull-requests: write | |
issues: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
validate-title: | |
name: Validate PR Title | |
runs-on: ubuntu-latest | |
steps: | |
- name: Validate PR title | |
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
# Configure allowed types based on conventional commits | |
types: | | |
feat | |
fix | |
docs | |
style | |
refactor | |
perf | |
test | |
build | |
ci | |
chore | |
revert | |
# Allow scope to be optional | |
requireScope: false | |
# Disable validation of the subject's case | |
subjectPattern: ^[a-z].+[^.]$ | |
# Disable validation of the subject's case | |
subjectPatternError: | | |
The subject "{subject}" found in the pull request title "{title}" | |
didn't match the configured pattern. Please ensure that the subject | |
starts with a lowercase character and doesn't end with a period. | |
# GitHub releases don't support scopes | |
githubBaseUrl: https://api.github.com | |
# Ignore merge commits | |
ignoreLabels: | | |
ignore-semantic-pull-request | |
auto-label: | |
name: Auto Label PR | |
runs-on: ubuntu-latest | |
needs: validate-title | |
steps: | |
- name: Label PR based on title | |
uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
configuration-path: .github/pr-labeler.yml | |
sync-labels: true | |
- name: Add conventional commit type label | |
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const title = context.payload.pull_request.title; | |
const typeMatch = title.match(/^(\w+)(\(.+\))?\:/); | |
if (typeMatch) { | |
const type = typeMatch[1]; | |
const labels = ['type:' + type]; | |
// Add additional semantic labels | |
const semanticLabels = { | |
'feat': ['enhancement'], | |
'fix': ['bug'], | |
'docs': ['documentation'], | |
'perf': ['performance'], | |
'test': ['testing'], | |
'ci': ['ci/cd'], | |
'build': ['build'], | |
'chore': ['maintenance'] | |
}; | |
if (semanticLabels[type]) { | |
labels.push(...semanticLabels[type]); | |
} | |
// Add labels to PR | |
for (const label of labels) { | |
try { | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.payload.pull_request.number, | |
labels: [label] | |
}); | |
} catch (error) { | |
console.log(`Label "${label}" might not exist, skipping...`); | |
} | |
} | |
} | |
size-label: | |
name: Size Label | |
runs-on: ubuntu-latest | |
steps: | |
- name: Add size label | |
uses: pascalgn/size-label-action@f8edde36b3be04b4f65dcfead05dc8691b374348 # v0.5.5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
sizes: > | |
{ | |
"0": "XS", | |
"10": "S", | |
"30": "M", | |
"100": "L", | |
"500": "XL", | |
"1000": "XXL" | |
} |