chore: add changeset for VuePivottable props fixes #34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integrate Develop to Staging | |
on: | |
push: | |
branches: | |
- develop | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
create-or-update-pr: | |
name: Create or Update PR to Staging | |
runs-on: ubuntu-latest | |
# Skip if this is a sync from main (by github-actions bot) | |
if: "github.event.head_commit.author.name != 'github-actions[bot]'" | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22.10.0' | |
- name: Check for existing PR | |
id: check-pr | |
run: | | |
EXISTING_PR=$(gh pr list --base staging --head develop --json number --jq '.[0].number' || echo "") | |
if [ -n "$EXISTING_PR" ]; then | |
echo "pr_exists=true" >> $GITHUB_OUTPUT | |
echo "pr_number=$EXISTING_PR" >> $GITHUB_OUTPUT | |
echo "Found existing PR #$EXISTING_PR" | |
else | |
echo "pr_exists=false" >> $GITHUB_OUTPUT | |
echo "No existing PR found" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit information | |
id: commit-info | |
run: | | |
# Fetch staging branch | |
git fetch origin staging:staging || echo "Staging branch not found" | |
# Get the latest commits from develop that aren't in staging | |
if git rev-parse --verify origin/staging >/dev/null 2>&1; then | |
COMMITS=$(git log --pretty=format:"- %s (%h)" origin/staging..HEAD | head -20) | |
COMMIT_COUNT=$(git rev-list --count origin/staging..HEAD) | |
else | |
COMMITS=$(git log --pretty=format:"- %s (%h)" HEAD | head -20) | |
COMMIT_COUNT=$(git rev-list --count HEAD) | |
fi | |
# Escape for GitHub Actions output | |
COMMITS="${COMMITS//'%'/'%25'}" | |
COMMITS="${COMMITS//$'\n'/'%0A'}" | |
COMMITS="${COMMITS//$'\r'/'%0D'}" | |
echo "commits<<EOF" >> $GITHUB_OUTPUT | |
echo "$COMMITS" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
echo "commit_count=$COMMIT_COUNT" >> $GITHUB_OUTPUT | |
# Get timestamp | |
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M:%S UTC") | |
echo "timestamp=$TIMESTAMP" >> $GITHUB_OUTPUT | |
- name: Create PR to staging | |
if: steps.check-pr.outputs.pr_exists == 'false' | |
run: | | |
COMMIT_COUNT="${{ steps.commit-info.outputs.commit_count }}" | |
TIMESTAMP="${{ steps.commit-info.outputs.timestamp }}" | |
# Create PR body file | |
{ | |
echo "## 🚀 Integration from develop to staging" | |
echo "" | |
echo "### 📊 Summary" | |
echo "- **Commits**: ${COMMIT_COUNT} new commits" | |
echo "- **Created**: ${TIMESTAMP}" | |
echo "- **Auto-generated**: This PR was automatically created by the integration workflow" | |
echo "" | |
echo "### 📝 Recent Commits" | |
echo "${{ steps.commit-info.outputs.commits }}" | |
echo "" | |
echo "### 🔍 What happens next?" | |
echo "1. Review the changes in this PR" | |
echo "2. Run any necessary QA tests" | |
echo "3. When approved and merged, the staging workflow will:" | |
echo " - Check for changesets" | |
echo " - If found, create beta releases" | |
echo " - Automatically create a PR to main" | |
echo "" | |
echo "### ⚡ Notes" | |
echo "- This PR will be automatically updated with new commits to develop" | |
echo "- Multiple features can accumulate in this single PR" | |
echo "- Approval triggers the beta release process" | |
} > pr-body.md | |
gh pr create \ | |
--base staging \ | |
--head develop \ | |
--title "🔄 Integrate develop → staging" \ | |
--body-file pr-body.md \ | |
--label "auto-updated" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update existing PR | |
if: steps.check-pr.outputs.pr_exists == 'true' | |
run: | | |
PR_NUMBER="${{ steps.check-pr.outputs.pr_number }}" | |
COMMIT_COUNT="${{ steps.commit-info.outputs.commit_count }}" | |
TIMESTAMP="${{ steps.commit-info.outputs.timestamp }}" | |
COMMITS="${{ steps.commit-info.outputs.commits }}" | |
# Update PR title with commit count | |
gh pr edit $PR_NUMBER \ | |
--title "🔄 Integrate develop → staging (${COMMIT_COUNT} commits)" | |
# Get current PR body | |
CURRENT_BODY=$(gh pr view $PR_NUMBER --json body --jq '.body') | |
# Create updated section safely using echo commands | |
{ | |
echo "### 🔄 Last Updated: ${TIMESTAMP}" | |
echo "New commits: ${COMMIT_COUNT}" | |
echo "" | |
echo "### 📝 Recent Commits" | |
echo "${COMMITS}" | sed 's/%0A/\n/g; s/%0D//g; s/%25/%/g' | |
} > updated-section.md | |
UPDATED_SECTION=$(cat updated-section.md) | |
# Update or append the updated section | |
if echo "$CURRENT_BODY" | grep -q "### 🔄 Last Updated:"; then | |
# Replace existing update section | |
NEW_BODY=$(echo "$CURRENT_BODY" | sed '/### 🔄 Last Updated:/,/### 📝 Recent Commits/d' | sed '/^$/d') | |
NEW_BODY="$NEW_BODY\n\n$UPDATED_SECTION" | |
else | |
# Append update section | |
NEW_BODY="$CURRENT_BODY\n\n---\n\n$UPDATED_SECTION" | |
fi | |
# Update PR body | |
echo "$NEW_BODY" > pr-body-update.md | |
gh pr edit $PR_NUMBER --body-file pr-body-update.md | |
# Add labels | |
gh pr edit $PR_NUMBER \ | |
--add-label "needs-review" | |
# Set as ready for review | |
gh pr ready $PR_NUMBER || true | |
echo "✅ Updated PR #${PR_NUMBER} with ${COMMIT_COUNT} new commits" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |