Skip to content

Commit 686be3a

Browse files
sotashimozonoclaude
andcommitted
Unify GitHub Actions workflows with ParamIO/DataVault
- Add FormatFix.yml (replaces FormatCheck.yml): auto-commits Blue style formatting on PR - Add PRLabeler.yml: labels PR from checkbox selections in template - Add PublishRelease.yml: creates GitHub release on git tag push - Add VersionCheck.yml: enforces Project.toml version bump on every PR to main - Add AutoMerge.yml (updated): trigger on Bot PRs or automerge label - Add .github/release-drafter.yml and PULL_REQUEST_TEMPLATE.md - Update CI.yml, Documentation.yml: checkout@v6 and clean up comments Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 124af71 commit 686be3a

10 files changed

Lines changed: 245 additions & 23 deletions

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Description
2+
3+
Fixed: # (if any)
4+
5+
## Type of Change
6+
7+
- [ ]**Feature** (`enhancement`)
8+
- [ ] 🐛 **Bug Fix** (`bug`)
9+
- [ ]**Performance** (`performance`)
10+
- [ ] 📖 **Documentation** (`documentation`)
11+
- [ ] 🧰 **Maintenance** (`chore` or `refactor`)
12+
13+
## Proposed Changes
14+
15+
what did you change?
16+
17+
- write here
18+
19+
## Usage or Results
20+
21+
```julia
22+
# Example or verification script
23+
24+
```
25+
26+
## check list
27+
- [ ] test駆動をしたか
28+
- [ ] Project.tomlのバージョンを上げたか

.github/release-drafter.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
version-resolver:
4+
major:
5+
labels: ['major']
6+
minor:
7+
labels: ['minor']
8+
patch:
9+
labels: ['patch']
10+
default: patch
11+
categories:
12+
- title: '🚀 Features'
13+
labels:
14+
- 'enhancement'
15+
- 'feature'
16+
- title: '🐛 Bug Fixes'
17+
labels:
18+
- 'bug'
19+
- 'fix'
20+
- title: '⚡ Performance'
21+
labels:
22+
- 'performance'
23+
- title: '📖 Documentation'
24+
labels:
25+
- 'documentation'
26+
- title: '🧰 Maintenance'
27+
labels:
28+
- 'chore'
29+
- 'refactor'
30+
31+
template: |
32+
$CHANGES

.github/workflows/AutoMerge.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: AutoMerge
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened]
5+
types: [opened, synchronize, reopened, labeled] # label反応も入れると便利
66

77
permissions:
88
contents: write
@@ -12,12 +12,11 @@ jobs:
1212
auto-merge:
1313
runs-on: ubuntu-latest
1414
if: >
15-
github.actor == 'dependabot[bot]' ||
16-
github.actor == 'CompatHelper[bot]' ||
17-
github.actor == 'github-actions[bot]'
15+
github.event.pull_request.user.type == 'Bot' ||
16+
contains(github.event.pull_request.labels.*.name, 'automerge')
1817
steps:
1918
- name: Enable auto-merge
2019
env:
2120
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2221
PR_URL: ${{ github.event.pull_request.html_url }}
23-
run: gh pr merge --auto --merge "$PR_URL"
22+
run: gh pr merge --auto --merge "$PR_URL"

.github/workflows/CI.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
- uses: julia-actions/cache@v3
2828
- uses: julia-actions/julia-buildpkg@v1
2929
- uses: julia-actions/julia-runtest@v1
30-
# ▼ ここがJulia用のCodecov連携部分です ▼
3130
- uses: julia-actions/julia-processcoverage@v1
3231
- uses: codecov/codecov-action@v6
3332
with:

.github/workflows/Documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v6
1717
- uses: julia-actions/setup-julia@v2
1818
with:
1919
version: '1'

.github/workflows/FormatCheck.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/FormatFix.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Format Fix
2+
on:
3+
pull_request:
4+
paths: ['**/*.jl']
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
format-fix:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v6
14+
with:
15+
ref: ${{ github.head_ref }}
16+
- uses: julia-actions/setup-julia@v2
17+
with:
18+
version: '1'
19+
- name: Run JuliaFormatter
20+
run: |
21+
julia -e 'using Pkg; Pkg.add("JuliaFormatter"); using JuliaFormatter; format(".")'
22+
- name: Commit changes
23+
uses: stefanzweifel/git-auto-commit-action@v7
24+
with:
25+
commit_message: "🤖 Format code (Blue style)"

.github/workflows/PRLabeler.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Checkbox Labeler
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
labeler:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Update Labels based on Checkboxes
15+
env:
16+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
PR_BODY: ${{ github.event.pull_request.body }}
18+
PR_NUMBER: ${{ github.event.pull_request.number }}
19+
run: |
20+
if echo "$PR_BODY" | grep -qi "\- \[x\] ✨ Feature"; then
21+
gh pr edit "$PR_NUMBER" --add-label "feature"
22+
fi
23+
24+
if echo "$PR_BODY" | grep -qi "\- \[x\] 🐛 Bug Fix"; then
25+
gh pr edit "$PR_NUMBER" --add-label "bug"
26+
fi
27+
28+
if echo "$PR_BODY" | grep -qi "\- \[x\] ⚡ Performance"; then
29+
gh pr edit "$PR_NUMBER" --add-label "performance"
30+
fi
31+
32+
if echo "$PR_BODY" | grep -qi "\- \[x\] 📖 Documentation"; then
33+
gh pr edit "$PR_NUMBER" --add-label "documentation"
34+
fi
35+
36+
if echo "$PR_BODY" | grep -qi "\- \[x\] 🧰 Maintenance"; then
37+
gh pr edit "$PR_NUMBER" --add-label "maintenance"
38+
fi
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Build release body
20+
id: body
21+
env:
22+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
TAG="${{ github.ref_name }}"
25+
BODY=$(gh release view "$TAG" --json body --jq '.body' 2>/dev/null || echo "")
26+
27+
if [ -z "$BODY" ] || [ "$BODY" = "null" ]; then
28+
BODY=$(gh release list --limit 50 --json tagName,isDraft \
29+
--jq '.[] | select(.isDraft == true) | .tagName' | head -n 1 | xargs -I{} gh release view {} --json body --jq '.body' 2>/dev/null || echo "")
30+
fi
31+
32+
if [ -z "$BODY" ] || [ "$BODY" = "null" ]; then
33+
BODY="## Changelog\n\n- See changelog/commit history for details in $TAG."
34+
fi
35+
36+
printf 'content<<EOF\n%s\nEOF\n' "$BODY" >> "$GITHUB_OUTPUT"
37+
38+
- name: Create or update release
39+
env:
40+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
run: |
42+
TAG="${{ github.ref_name }}"
43+
BODY="${{ steps.body.outputs.content }}"
44+
45+
if gh release view "$TAG" >/dev/null 2>&1; then
46+
gh release edit "$TAG" --title "$TAG" --notes "$BODY" --draft=false
47+
else
48+
gh release create "$TAG" --title "$TAG" --notes "$BODY"
49+
fi

.github/workflows/VersionCheck.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: VersionCheck
2+
3+
# Ensures that every PR targeting main bumps Project.toml version.
4+
# The check fails if the version in the PR branch is not strictly greater
5+
# than the version on the base branch.
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- main
11+
paths:
12+
- Project.toml
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
18+
jobs:
19+
check-version:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
# Fetch both the PR branch and the base branch so we can compare.
25+
fetch-depth: 0
26+
27+
- name: Get base branch version
28+
id: base
29+
run: |
30+
git fetch origin ${{ github.base_ref }} --depth=1
31+
VERSION=$(git show origin/${{ github.base_ref }}:Project.toml \
32+
| grep '^version' | head -1 | sed 's/.*"\(.*\)"/\1/')
33+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
34+
echo "Base version: $VERSION"
35+
36+
- name: Get PR branch version
37+
id: pr
38+
run: |
39+
VERSION=$(grep '^version' Project.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
40+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
41+
echo "PR version: $VERSION"
42+
43+
- name: Compare versions (semver)
44+
env:
45+
BASE: ${{ steps.base.outputs.version }}
46+
PR: ${{ steps.pr.outputs.version }}
47+
run: |
48+
# Split a semver string into its numeric parts and compare.
49+
version_gt() {
50+
# Returns 0 (success) if $1 > $2 as semver, 1 otherwise.
51+
IFS='.' read -r -a A <<< "$1"
52+
IFS='.' read -r -a B <<< "$2"
53+
for i in 0 1 2; do
54+
a="${A[$i]:-0}"
55+
b="${B[$i]:-0}"
56+
if [ "$a" -gt "$b" ]; then return 0; fi
57+
if [ "$a" -lt "$b" ]; then return 1; fi
58+
done
59+
return 1 # equal is not greater
60+
}
61+
62+
echo "Base: $BASE → PR: $PR"
63+
if version_gt "$PR" "$BASE"; then
64+
echo "✓ Version bumped ($BASE → $PR)"
65+
else
66+
echo "✗ Version NOT bumped. PR version ($PR) must be strictly greater than base version ($BASE)."
67+
exit 1
68+
fi

0 commit comments

Comments
 (0)