Skip to content

Commit

Permalink
chore: check the latest branch of honojs/starter (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukebe authored Feb 3, 2025
1 parent cf857d5 commit f54dcf5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/check-template-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Check Template Branch

on:
push:
branches:
- main

jobs:
check_template_branch:
runs-on: ubuntu-latest

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

- name: Get create-hono version
id: get_version
run: |
VERSION=$(jq -r .version package.json)
MAJOR_MINOR=$(echo "$VERSION" | cut -d '.' -f 1,2)
echo "Detected version: $VERSION"
echo "Branch to check: v$MAJOR_MINOR"
echo "branch_name=v$MAJOR_MINOR" >> "$GITHUB_ENV"
- name: Check if branch exists in template repository
id: check_branch
run: |
TEMPLATE_REPO="honojs/starter"
BRANCH_NAME=${{ env.branch_name }}
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
"https://api.github.com/repos/$TEMPLATE_REPO/git/refs/heads/$BRANCH_NAME")
if [ "$RESPONSE" -ne 200 ]; then
echo "Error: Branch '$BRANCH_NAME' does not exist in $TEMPLATE_REPO"
exit 1
fi
- name: Notify branch exists
if: success()
run: |
echo "Branch ${{ env.branch_name }} exists in the template repository."
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ import {
registerInstallationHook,
} from './hooks/dependencies'

const [major, minor] = version.split('.')
const ref = `v${major}.${minor}`

const isCurrentDirRegex = /^(\.\/|\.\\|\.)$/
const directoryName = 'templates'
const config = {
directory: directoryName,
repository: 'starter',
user: 'honojs',
ref: 'main',
ref,
} as const

const templates = [
Expand Down

0 comments on commit f54dcf5

Please sign in to comment.