mirror of
https://github.com/notf0und/SGS
synced 2026-07-17 18:21:06 +00:00
Add PR templates, CI workflows, and release drafter config files
This commit is contained in:
parent
d0531fee49
commit
97024acef1
@@ -0,0 +1,27 @@
|
|||||||
|
## What does this PR do?
|
||||||
|
|
||||||
|
<!-- A clear and concise description of the change -->
|
||||||
|
|
||||||
|
## Commits
|
||||||
|
|
||||||
|
<!-- Populated automatically by CI — do not edit this section -->
|
||||||
|
|
||||||
|
## Type of change
|
||||||
|
|
||||||
|
<!-- Add the matching label to this PR -->
|
||||||
|
|
||||||
|
- [ ] 🚀 Feature / Enhancement (`feature`, `enhancement`)
|
||||||
|
- [ ] 🐛 Bug Fix (`bug`, `fix`)
|
||||||
|
- [ ] 🧪 Tests (`test`)
|
||||||
|
- [ ] 🧹 Maintenance / Chore (`chore`, `dependencies`)
|
||||||
|
- [ ] 📖 Documentation (`docs`)
|
||||||
|
- [ ] 💥 Breaking Change (`breaking`)
|
||||||
|
|
||||||
|
## How to test
|
||||||
|
|
||||||
|
<!-- Steps to verify the change works as expected -->
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
- [ ] Tests pass (`php artisan test`)
|
||||||
|
- [ ] Code style passes (`./vendor/bin/pint --test`)
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
name-template: 'v$RESOLVED_VERSION'
|
||||||
|
tag-template: 'v$RESOLVED_VERSION'
|
||||||
|
|
||||||
|
categories:
|
||||||
|
- title: '🚀 Features'
|
||||||
|
labels:
|
||||||
|
- 'feature'
|
||||||
|
- 'enhancement'
|
||||||
|
- title: '🐛 Bug Fixes'
|
||||||
|
labels:
|
||||||
|
- 'bug'
|
||||||
|
- 'fix'
|
||||||
|
- title: '🧪 Tests'
|
||||||
|
labels:
|
||||||
|
- 'test'
|
||||||
|
- 'tests'
|
||||||
|
- title: '🧹 Maintenance'
|
||||||
|
labels:
|
||||||
|
- 'chore'
|
||||||
|
- 'maintenance'
|
||||||
|
- 'dependencies'
|
||||||
|
- title: '📖 Documentation'
|
||||||
|
labels:
|
||||||
|
- 'docs'
|
||||||
|
- 'documentation'
|
||||||
|
|
||||||
|
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
|
||||||
|
change-title-escapes: '\<*_&'
|
||||||
|
|
||||||
|
version-resolver:
|
||||||
|
major:
|
||||||
|
labels:
|
||||||
|
- 'breaking'
|
||||||
|
minor:
|
||||||
|
labels:
|
||||||
|
- 'feature'
|
||||||
|
- 'enhancement'
|
||||||
|
patch:
|
||||||
|
labels:
|
||||||
|
- 'bug'
|
||||||
|
- 'fix'
|
||||||
|
- 'chore'
|
||||||
|
- 'maintenance'
|
||||||
|
- 'docs'
|
||||||
|
- 'documentation'
|
||||||
|
- 'test'
|
||||||
|
- 'tests'
|
||||||
|
- 'dependencies'
|
||||||
|
default: patch
|
||||||
|
|
||||||
|
template: |
|
||||||
|
$CHANGES
|
||||||
|
|
||||||
|
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
name: Populate PR commits
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-body:
|
||||||
|
name: Inject commit list into PR body
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { data: commits } = await github.rest.pulls.listCommits({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
pull_number: context.payload.pull_request.number,
|
||||||
|
});
|
||||||
|
|
||||||
|
const commitLines = commits
|
||||||
|
.map(c => `- ${c.commit.message.split('\n')[0]} (${c.sha.slice(0, 7)})`)
|
||||||
|
.join('\n');
|
||||||
|
|
||||||
|
const currentBody = context.payload.pull_request.body ?? '';
|
||||||
|
|
||||||
|
// Replace everything between the Commits header and the next ## header
|
||||||
|
const updated = currentBody.replace(
|
||||||
|
/(## Commits\n)[\s\S]*?(\n## )/,
|
||||||
|
`$1\n${commitLines}\n$2`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (updated === currentBody) return;
|
||||||
|
|
||||||
|
await github.rest.pulls.update({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
pull_number: context.payload.pull_request.number,
|
||||||
|
body: updated,
|
||||||
|
});
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
name: Release Drafter
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
types: [opened, reopened, synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
draft:
|
||||||
|
name: Draft next release notes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: release-drafter/release-drafter@v6
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -87,7 +87,7 @@ jobs:
|
|||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name | lower }}
|
images: ${{ secrets.DOCKERHUB_USERNAME }}/sgs
|
||||||
tags: |
|
tags: |
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
|
|||||||
@@ -60,3 +60,41 @@ jobs:
|
|||||||
- name: Run Pint
|
- name: Run Pint
|
||||||
working-directory: www
|
working-directory: www
|
||||||
run: ./vendor/bin/pint --test
|
run: ./vendor/bin/pint --test
|
||||||
|
|
||||||
|
update-checklist:
|
||||||
|
name: Update PR checklist
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: always() && github.event_name == 'pull_request'
|
||||||
|
needs: [test, lint]
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const testsPass = '${{ needs.test.result }}' === 'success';
|
||||||
|
const lintPass = '${{ needs.lint.result }}' === 'success';
|
||||||
|
|
||||||
|
const check = (pass) => pass ? 'x' : ' ';
|
||||||
|
|
||||||
|
const { data: pr } = await github.rest.pulls.get({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
pull_number: context.payload.pull_request.number,
|
||||||
|
});
|
||||||
|
|
||||||
|
const body = (pr.body ?? '').replace(
|
||||||
|
/- \[[ x]\] Tests pass \(`php artisan test`\)/,
|
||||||
|
`- [${check(testsPass)}] Tests pass (\`php artisan test\`)`
|
||||||
|
).replace(
|
||||||
|
/- \[[ x]\] Code style passes \(`\.\/vendor\/bin\/pint --test`\)/,
|
||||||
|
`- [${check(lintPass)}] Code style passes (\`./vendor/bin/pint --test\`)`
|
||||||
|
);
|
||||||
|
|
||||||
|
await github.rest.pulls.update({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
pull_number: context.payload.pull_request.number,
|
||||||
|
body,
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user