Skip to content

feat(ci): update Node.js version to 24 and enhance npm ci with retry … #107

feat(ci): update Node.js version to 24 and enhance npm ci with retry …

feat(ci): update Node.js version to 24 and enhance npm ci with retry … #107

Workflow file for this run

name: Auto PR (beta → master)
# Creates or updates the release PR from beta to master.
# Enables auto-merge so GitHub merges the PR when all checks pass.
on:
push:
branches: [beta]
permissions:
contents: read
pull-requests: write
concurrency:
group: auto-pr-beta
cancel-in-progress: true
jobs:
auto-pr:
runs-on: ubuntu-latest
timeout-minutes: 5
# Skip [skip-ci] commits (e.g. sync-beta back-merges) to prevent loops
if: "!contains(github.event.head_commit.message, '[skip-ci]')"
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Validate PAT exists
run: |
if [ -z "${{ secrets.FIELDTRACK_PAT }}" ]; then
echo "::error::FIELDTRACK_PAT secret is not set"
exit 1
fi
- name: Check for existing PR
id: pr
env:
GH_TOKEN: ${{ secrets.FIELDTRACK_PAT }}
run: |
PR_NUMBER=$(gh pr list \
--base master \
--head beta \
--state open \
--json number \
--jq '.[0].number // ""')
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
- name: Generate commit summary
id: summary
run: |
git fetch origin master
COMMITS=$(git log origin/master..HEAD \
--no-merges \
--pretty=format:"- %s" \
| awk '!seen[$0]++' \
| head -20)
if [ -z "$COMMITS" ]; then
echo "empty=true" >> $GITHUB_OUTPUT
exit 0
fi
echo "empty=false" >> $GITHUB_OUTPUT
printf "%s\n" "$COMMITS" > commits.txt
- name: Create PR
if: steps.pr.outputs.pr_number == '' && steps.summary.outputs.empty != 'true'
env:
GH_TOKEN: ${{ secrets.FIELDTRACK_PAT }}
run: |
{
echo "## 🚀 Automated Release PR"
echo ""
echo "This PR contains all changes from beta to master."
echo ""
echo "---"
echo ""
echo "## 📦 Latest Changes"
echo ""
echo "<!-- AUTO-GENERATED:START -->"
cat commits.txt
echo "<!-- AUTO-GENERATED:END -->"
echo ""
echo "---"
echo ""
echo "## 🧠 Notes"
echo "- Auto-managed PR"
echo "- Do not edit manually"
} > body.txt
gh pr create \
--base master \
--head beta \
--title "🚀 Release: beta → master" \
--body-file body.txt
echo "✓ PR created"
- name: Update PR body
if: steps.pr.outputs.pr_number != '' && steps.summary.outputs.empty != 'true'
env:
GH_TOKEN: ${{ secrets.FIELDTRACK_PAT }}
run: |
PR="${{ steps.pr.outputs.pr_number }}"
gh pr view "$PR" --json body -q .body > old_body.txt
awk '/<!-- AUTO-GENERATED:START -->/{exit} {print}' old_body.txt > before.txt
awk 'f;/<!-- AUTO-GENERATED:END -->/{f=1}' old_body.txt | tail -n +2 > after.txt
echo "<!-- AUTO-GENERATED:START -->" > block.txt
cat commits.txt >> block.txt
echo "<!-- AUTO-GENERATED:END -->" >> block.txt
cat before.txt block.txt after.txt > final_body.txt
if ! diff -q old_body.txt final_body.txt > /dev/null 2>&1; then
gh pr edit "$PR" --body-file final_body.txt
echo "✓ PR #$PR body updated"
else
echo "No changes in PR body"
fi
- name: Enable auto-merge
env:
GH_TOKEN: ${{ secrets.FIELDTRACK_PAT }}
run: |
PR=$(gh pr list \
--base master \
--head beta \
--state open \
--json number \
--jq '.[0].number // ""')
if [ -z "$PR" ]; then
echo "⚠️ No PR found, auto-merge not enabled"
exit 0
fi
echo "Enabling auto-merge for PR #$PR"
gh pr merge "$PR" \
--auto \
--squash \
--delete-branch=false || true
echo "✓ Auto-merge enabled"