mirror of
https://github.com/hanzoai/pack.git
synced 2026-09-30 23:43:13 +00:00
test: automatically generate mise upgrade PRs (#485)
* build: ignore all gemini stuff for now * build: add workflow for automated mise update PRs * tmp tweaks to test if the PR workflow operates * tmp fix to test workflow * build: don't rely on a specific remote, use hardcoded canonical repo when pushing a mise update
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
name: Update Mise Version
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
env:
|
||||
MISE_ENV: ci
|
||||
|
||||
jobs:
|
||||
update-mise:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db
|
||||
|
||||
# We manually configure the git user here to support the mise-upgrade script
|
||||
# which handles the commit and PR creation. This keeps the script as the
|
||||
# single source of truth for both local and CI usage.
|
||||
- run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- run: mise run mise-upgrade
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
+3
-2
@@ -45,8 +45,9 @@ build/
|
||||
|
||||
tmp/
|
||||
|
||||
examples/*/size.json
|
||||
|
||||
### AI Tooling ###
|
||||
.claude/settings.local.json
|
||||
examples/**/.claude
|
||||
|
||||
examples/*/size.json
|
||||
.gemini/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env zsh
|
||||
#!/usr/bin/env bash
|
||||
# Description: one-click command to check for a new mise version and create a PR to update core/mise/version.txt.
|
||||
|
||||
set -euo pipefail
|
||||
@@ -6,14 +6,29 @@ set -euo pipefail
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
cd "$repo_root"
|
||||
|
||||
# Ensure upstream remote exists
|
||||
if ! git remote | grep -q '^upstream$'; then
|
||||
echo "Error: 'upstream' remote is not configured. Please add it to fetch the latest changes." >&2
|
||||
# Check that we're on the main branch
|
||||
current_branch="$(git branch --show-current)"
|
||||
if [[ "$current_branch" != "main" ]]; then
|
||||
echo "Error: must be on 'main' branch, currently on '$current_branch'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Fetch latest changes from upstream
|
||||
git fetch upstream main
|
||||
# Pull latest changes from the canonical railpack remote
|
||||
canonical_repo="railwayapp/railpack"
|
||||
canonical_url="https://github.com/$canonical_repo"
|
||||
remote_name=$(git remote -v | grep "$canonical_repo" | head -n1 | awk '{print $1}')
|
||||
|
||||
if [[ -n "$remote_name" ]]; then
|
||||
echo "Updating from remote: $remote_name ($canonical_url)"
|
||||
git fetch "$remote_name" main
|
||||
git pull "$remote_name" main
|
||||
base_branch="$remote_name/main"
|
||||
else
|
||||
echo "Updating from URL: $canonical_url"
|
||||
git fetch "$canonical_url" main
|
||||
git pull "$canonical_url" main
|
||||
base_branch="FETCH_HEAD"
|
||||
fi
|
||||
|
||||
# Require clean working tree for tracked files
|
||||
if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
|
||||
@@ -47,7 +62,7 @@ if git show-ref --verify --quiet "refs/heads/$branch"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git switch -c "$branch" upstream/main
|
||||
git switch -c "$branch" "$base_branch"
|
||||
|
||||
# Write the new version to version.txt
|
||||
echo "$latest" > "$file"
|
||||
@@ -69,6 +84,10 @@ fi
|
||||
git add -- "$file"
|
||||
git commit -m "update mise $latest"
|
||||
|
||||
# Push the branch (needed in CI and good practice locally)
|
||||
git push -u origin "$branch"
|
||||
|
||||
gh pr create \
|
||||
--repo "$canonical_repo" \
|
||||
--title "chore: mise update $latest" \
|
||||
--body "Update mise to $latest" \
|
||||
--body "Update mise to $latest"
|
||||
|
||||
Reference in New Issue
Block a user