feat: Add comprehensive dark mode support #4
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, synchronize, reopened] | |
jobs: | |
lint: | |
name: SwiftLint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: SwiftLint | |
uses: norio-nomura/action-swiftlint@3.2.1 | |
with: | |
args: --strict | |
continue-on-error: true | |
- name: Comment PR with SwiftLint results | |
uses: actions/github-script@v7 | |
if: github.event_name == 'pull_request' | |
with: | |
script: | | |
const output = '${{ steps.swiftlint.outputs.stdout }}'; | |
if (output) { | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '## SwiftLint Results\n\n```\n' + output + '\n```' | |
}); | |
} | |
pr-size: | |
name: PR Size Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check PR size | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const pr = context.payload.pull_request; | |
const additions = pr.additions; | |
const deletions = pr.deletions; | |
const total = additions + deletions; | |
let label = ''; | |
if (total < 10) label = 'size/XS'; | |
else if (total < 50) label = 'size/S'; | |
else if (total < 200) label = 'size/M'; | |
else if (total < 500) label = 'size/L'; | |
else if (total < 1000) label = 'size/XL'; | |
else label = 'size/XXL'; | |
// Remove all size labels | |
const labels = await github.rest.issues.listLabelsOnIssue({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: pr.number | |
}); | |
for (const label of labels.data) { | |
if (label.name.startsWith('size/')) { | |
await github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: pr.number, | |
name: label.name | |
}); | |
} | |
} | |
// Add new size label | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: pr.number, | |
labels: [label] | |
}); | |
check-commits: | |
name: Check Commit Messages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check commits | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const commits = await github.rest.pulls.listCommits({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number | |
}); | |
const conventionalCommitRegex = /^(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert)(\(.+\))?: .+/; | |
const invalidCommits = []; | |
for (const commit of commits.data) { | |
const message = commit.commit.message.split('\n')[0]; | |
if (!conventionalCommitRegex.test(message)) { | |
invalidCommits.push(`- ${commit.sha.substring(0, 7)}: ${message}`); | |
} | |
} | |
if (invalidCommits.length > 0) { | |
core.warning(`Found ${invalidCommits.length} commits without conventional format:\n${invalidCommits.join('\n')}`); | |
} |