Skip to content

Sortable stacks with lock functionality #21

Sortable stacks with lock functionality

Sortable stacks with lock functionality #21

Workflow file for this run

# .github/workflows/sync-plugin-url.yml
# Ensures the PLG pluginURL entity always points to the current branch
#
# This prevents issues when merging between dev and main where the
# pluginURL would reference the wrong branch for update checks.
#
# Triggers only on PR merges to main or dev (the only time the
# pluginURL branch reference can be wrong is after a cross-branch merge)
name: Sync Plugin URL
on:
pull_request:
types: [closed]
branches: [main, dev]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: false
jobs:
sync-url:
permissions:
contents: write
runs-on: ubuntu-latest
# Only run if the PR was actually merged (not just closed)
if: github.event.pull_request.merged == true
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check and fix pluginURL branch + README badge
id: check
run: |
BRANCH="${GITHUB_REF_NAME}"
PLG_FILE="compose.manager.plg"
README_FILE="source/compose.manager/README.md"
NEEDS_COMMIT=false
# Ensure pluginURL uses the current branch
CURRENT_URL_BRANCH=$(grep -oP '<!ENTITY pluginURL.*github;/\K[^/]+' "$PLG_FILE" || echo "unknown")
echo "Current branch: $BRANCH"
echo "PLG pluginURL branch: $CURRENT_URL_BRANCH"
if [[ "$CURRENT_URL_BRANCH" != "$BRANCH" ]]; then
echo "Branch mismatch - fixing pluginURL..."
# Scope to pluginURL line only — avoids corrupting packageURL
sed -i "/pluginURL/s|/&github;/[^/]*/|/\&github;/${BRANCH}/|" "$PLG_FILE"
NEEDS_COMMIT=true
else
echo "pluginURL already correct"
fi
# Ensure README disposition matches branch
if [[ "$BRANCH" == "dev" ]]; then
# dev should show beta
if grep -q "^\*\*Compose Manager Plus (Beta)\*\*$" "$README_FILE"; then
echo "README already has beta title (dev branch)"
else
echo "Setting README title to beta form for dev branch..."
sed -i '1s|^\*\*Compose Manager Plus.*\*\*$|**Compose Manager Plus (Beta)**|' "$README_FILE"
NEEDS_COMMIT=true
fi
else
# main should not show beta
if grep -q "^\*\*Compose Manager Plus (Beta)\*\*$" "$README_FILE"; then
echo "Removing beta title from README for main branch..."
sed -i '1s|^\*\*Compose Manager Plus (Beta)\*\*$|**Compose Manager Plus**|' "$README_FILE"
NEEDS_COMMIT=true
else
echo "README already has non-beta title for main branch"
fi
fi
echo "needs_commit=$NEEDS_COMMIT" >> $GITHUB_OUTPUT
- name: Commit fix
if: steps.check.outputs.needs_commit == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add compose.manager.plg source/compose.manager/README.md
git commit -m "chore: sync pluginURL+README for ${GITHUB_REF_NAME} branch [skip ci]"
git pull --rebase origin "${GITHUB_REF_NAME}"
git push