Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name-template: "$RESOLVED_VERSION"
tag-template: "$RESOLVED_VERSION"

categories:
- title: Breaking Changes
labels: [breaking]
- title: Features
labels: [feat]
- title: Bug Fixes
labels: [fix]
- title: Refactoring
labels: [refactor]
- title: Documentation
labels: [docs]
- title: Testing
labels: [test]
- title: Build
labels: [build]

version-resolver:
minor:
labels: [breaking]
default: patch

template: |
$CHANGES
change-template: "- $TITLE (#$NUMBER)"
change-title-escapes: '\<*_&@'
no-changes-template: "No changes"
category-template: "### $TITLE"

exclude-labels:
- release

replacers:
- search: '/- (feat|fix|refactor|docs|ci|chore|test|build|release)(\(.+?\))?!?:\s*/g'
replace: "- "
17 changes: 17 additions & 0 deletions .github/workflows/coverage-badge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish Coverage Badge

on:
push:
branches:
- main

jobs:
publish-coverage-badge:
runs-on: ubuntu-22.04
steps:
- name: Trigger transformplan-static to update coverage badge
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.TRANSFORMPLAN_STATIC_TOKEN }}
repository: limebit/transformplan-static
event-type: publish-coverage-badge
31 changes: 31 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check Python Coverage

on:
push:
branches: [main]
pull_request:

jobs:
coverage:
runs-on: ubuntu-22.04
permissions:
pull-requests: write

steps:
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
python-version: "3.10"

- name: Install dependencies
run: |
uv sync --group tests

- name: Create coverage report
run: |
uv run coverage run -m pytest
uv run coverage report -m --fail-under=99
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5

Expand All @@ -40,7 +40,7 @@ jobs:

deploy:
needs: build
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
format:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v5
Expand All @@ -18,7 +18,8 @@ jobs:
python-version: "3.10"

- name: Install dependencies
run: uv sync --group dev
run: |
uv sync --group dev

- name: Format with ruff
run: uv run ruff format --check
5 changes: 3 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
lint:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v5
Expand All @@ -18,7 +18,8 @@ jobs:
python-version: "3.10"

- name: Install dependencies
run: uv sync --group dev
run: |
uv sync --group dev

- name: Lint with ruff
run: uv run ruff check --output-format=github .
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
comment:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
pull-requests: write

Expand All @@ -25,7 +25,7 @@ jobs:
* Documentation is updated if necessary.
`;

github.rest.issues.createComment({
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: PR Title

on:
pull_request:
types: [opened, edited, synchronize, reopened]

permissions:
contents: read
pull-requests: write

jobs:
validate-title:
runs-on: ubuntu-22.04

steps:
- name: Validate PR title
uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
refactor
docs
ci
chore
test
build
release
requireScope: false

label-pr:
needs: validate-title
runs-on: ubuntu-22.04

steps:
- name: Label PR by type
uses: actions/github-script@v7
with:
script: |
const title = context.payload.pull_request.title;
const prNumber = context.payload.pull_request.number;

const typeMatch = title.match(/^(\w+)/);
const labelsToAdd = [];
const type = typeMatch ? typeMatch[1] : '';

const changelogTypes = ['feat', 'fix', 'refactor', 'docs', 'test', 'build'];
if (changelogTypes.includes(type)) {
labelsToAdd.push(type);
}

if (type === 'release') {
labelsToAdd.push('release');
}

if (labelsToAdd.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: labelsToAdd,
});
}
95 changes: 95 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Prepare Release

on:
workflow_dispatch:
inputs:
version:
description: "Version override (leave empty to use release-drafter's resolved version)"
required: false
type: string

permissions:
contents: write
pull-requests: write

jobs:
prepare-release:
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Get draft release
id: draft
uses: release-drafter/release-drafter@v6
with:
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Determine version
id: version
env:
VERSION_OVERRIDE: ${{ inputs.version }}
RESOLVED_VERSION: ${{ steps.draft.outputs.resolved_version }}
run: |
if [ -n "$VERSION_OVERRIDE" ]; then
VERSION="$VERSION_OVERRIDE"
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "::error::Version must be in semver format (e.g., 0.2.0)"
exit 1
fi
else
VERSION="$RESOLVED_VERSION"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Update changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ steps.version.outputs.version }}
release-notes: ${{ steps.draft.outputs.body }}
path-to-changelog: CHANGELOG.md
heading-text: "[${{ steps.version.outputs.version }}]"

- name: Bump version
env:
VERSION: ${{ steps.version.outputs.version }}
run: sed -i '0,/^version = ".*"/s//version = "'"$VERSION"'"/' pyproject.toml

- name: Update uv.lock
run: uv lock

- name: Stage files
run: git add CHANGELOG.md pyproject.toml uv.lock

- name: Create release PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
run: |
BRANCH="release/${VERSION}"

git checkout -b "$BRANCH"
git -c user.name="github-actions[bot]" \
-c user.email="github-actions[bot]@users.noreply.github.com" \
commit -m "release: ${VERSION}"
git push origin "$BRANCH"

BODY="## Release ${VERSION}

This PR was automatically generated by the release workflow.

### Checklist
- [ ] Changelog looks correct
- [ ] Version numbers are correct"

gh pr create \
--title "release: ${VERSION}" \
--body "$BODY" \
--base main \
--head "$BRANCH"
Loading
Loading