Skip to content

Refactor ParameterData constructor to use cache key only #43

Refactor ParameterData constructor to use cache key only

Refactor ParameterData constructor to use cache key only #43

name: Sync .editorconfig from canonical (PR-only)
on:
push:
branches-ignore:
- "chore/sync-editorconfig" # bot PR branch
pull_request:
workflow_dispatch:
# Optional polling safety net (recommended for dormant repos):
# schedule:
# - cron: "17 * * * *" # hourly at :17
permissions:
contents: write
pull-requests: write
env:
CANONICAL_RAW_URL: https://raw.githubusercontent.com/BionicCode/bioniccode-code-style/refs/heads/main/BionicCode.CodeStyle/BionicCode.CodeStyle/.editorconfig
SYNC_BRANCH: chore/sync-editorconfig
# Concurrency scoped per PR or per ref (prevents cross-branch cancellations)
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
verify-on-pr:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout PR head
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Download canonical .editorconfig
run: |
set -euo pipefail
curl -fsSL "${CANONICAL_RAW_URL}" -o canonical.editorconfig
- name: Ensure exactly one tracked .editorconfig (strict)
run: |
set -euo pipefail
count=$(git ls-files '**/.editorconfig' | wc -l | tr -d ' ')
if [ "$count" -ne 1 ]; then
echo "::error::Expected exactly one tracked .editorconfig (repo root). Found: $count"
git ls-files '**/.editorconfig' || true
exit 1
fi
- name: Fail if branch .editorconfig is out of sync
run: |
set -euo pipefail
if cmp -s .editorconfig canonical.editorconfig; then
echo ".editorconfig is in sync with canonical."
else
echo "::error::.editorconfig is OUT OF SYNC with canonical. Merge the sync PR created by this workflow."
exit 1
fi
open-or-update-sync-pr:
# PR-only syncing: create/update a PR on default-branch pushes, or manual runs
if: >
github.event_name != 'pull_request' && github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout default branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
- name: Download canonical .editorconfig
run: |
set -euo pipefail
curl -fsSL "${CANONICAL_RAW_URL}" -o canonical.editorconfig
- name: Detect changes
id: diff
run: |
set -euo pipefail
if [ -f .editorconfig ] && cmp -s .editorconfig canonical.editorconfig; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
mv canonical.editorconfig .editorconfig
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Create or update PR
if: steps.diff.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
branch: ${{ env.SYNC_BRANCH }}
base: ${{ github.event.repository.default_branch }}
title: "chore: sync .editorconfig from canonical"
commit-message: "chore(sync): update .editorconfig from canonical"
body: |
Automated sync of `.editorconfig` from the canonical repository.
Source: BionicCode/bioniccode-code-style (main)
add-paths: |
.editorconfig
labels: automation