Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions .github/workflows/sync_from_upstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
token: ${{ secrets.PAT }}

- name: Fetch upstream and reset to match it
Expand All @@ -39,7 +40,7 @@ jobs:

git remote add upstream https://github.com/revisit-studies/study.git
UPSTREAM_REF="${{ github.event.inputs.upstream_ref }}"
git fetch upstream "${UPSTREAM_REF:-main}"
git fetch -- upstream "${UPSTREAM_REF:-main}"
UPSTREAM_SHA=$(git rev-parse FETCH_HEAD)
echo "UPSTREAM_SHA=$UPSTREAM_SHA" >> "$GITHUB_ENV"
echo "Syncing from upstream @ $UPSTREAM_SHA"
Expand Down Expand Up @@ -74,9 +75,9 @@ jobs:

- name: Remove study/demo folders not included in template
run: |
# Top-level public/: keep only shared assets and utilities.
# All studies and other extras brought in by the reset are removed.
KEEP_PUBLIC=("libraries" "revisitAssets" "revisitUtilities" "404.html" "vite.svg" "global.json" "README.md")
# Top-level public/: keep shared assets, utilities, and tutorial study assets.
# All other studies and extras brought in by the reset are removed.
KEEP_PUBLIC=("libraries" "tutorial" "revisitAssets" "revisitUtilities" "404.html" "vite.svg" "global.json" "README.md")
for item in public/*; do
name=$(basename "$item")
keep=false
Expand All @@ -89,8 +90,8 @@ jobs:
fi
done

# src/public/: keep library React components only.
KEEP_SRC_PUBLIC=("libraries")
# src/public/: keep library React components and tutorial dependencies.
KEEP_SRC_PUBLIC=("libraries" "tutorial" "example-brush-interactions")
for item in src/public/*; do
[[ -e "$item" ]] || continue # skip if glob matched nothing
name=$(basename "$item")
Expand All @@ -104,6 +105,9 @@ jobs:
fi
done

# Root tests/: remove upstream demo/example E2E tests from the template.
rm -rf tests

- name: Remove unused dependencies from package.json
run: |
node -e "
Expand All @@ -113,7 +117,6 @@ jobs:
// Packages only used in example studies removed from this template.
const unusedDeps = [
'@visdesignlab/upset2-react', // UpSet2 example study only
'arquero', // src/public/tutorial/ brush components only
'topojson-client', // src/public/demo-choropleth-map/ only
// MUI packages — not imported anywhere in src/ on dev branch
'@emotion/react',
Expand Down Expand Up @@ -146,6 +149,9 @@ jobs:
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"

- name: Refresh yarn.lock
run: yarn install --ignore-scripts --non-interactive

- name: Commit and force push to main
run: |
git config user.name "github-actions[bot]"
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/sync_from_upstream_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

git remote add upstream https://github.com/revisit-studies/study.git
UPSTREAM_REF="${{ github.event.inputs.upstream_ref }}"
git fetch upstream "${UPSTREAM_REF:-main}"
git fetch -- upstream "${UPSTREAM_REF:-main}"
UPSTREAM_SHA=$(git rev-parse FETCH_HEAD)
echo "UPSTREAM_SHA=$UPSTREAM_SHA" >> "$GITHUB_ENV"
echo "Syncing from upstream @ $UPSTREAM_SHA"
Expand All @@ -46,6 +46,7 @@ jobs:
# so the branch exists for the subsequent force push.
TARGET_BRANCH="${{ github.event.inputs.target_branch }}"
TARGET_BRANCH="${TARGET_BRANCH:-sync-test}"
git check-ref-format --branch "$TARGET_BRANCH"
echo "TARGET_BRANCH=$TARGET_BRANCH" >> "$GITHUB_ENV"
git checkout -B "$TARGET_BRANCH"

Expand Down Expand Up @@ -79,9 +80,9 @@ jobs:

- name: Remove study/demo folders not included in template
run: |
# Top-level public/: keep only shared assets and utilities.
# All studies and other extras brought in by the reset are removed.
KEEP_PUBLIC=("libraries" "revisitAssets" "revisitUtilities" "404.html" "vite.svg" "global.json" "README.md")
# Top-level public/: keep shared assets, utilities, and tutorial study assets.
# All other studies and extras brought in by the reset are removed.
KEEP_PUBLIC=("libraries" "tutorial" "revisitAssets" "revisitUtilities" "404.html" "vite.svg" "global.json" "README.md")
for item in public/*; do
name=$(basename "$item")
keep=false
Expand All @@ -94,8 +95,8 @@ jobs:
fi
done

# src/public/: keep library React components only.
KEEP_SRC_PUBLIC=("libraries")
# src/public/: keep library React components and tutorial dependencies.
KEEP_SRC_PUBLIC=("libraries" "tutorial" "example-brush-interactions")
for item in src/public/*; do
[[ -e "$item" ]] || continue # skip if glob matched nothing
name=$(basename "$item")
Expand All @@ -109,6 +110,9 @@ jobs:
fi
done

# Root tests/: remove upstream demo/example E2E tests from the template.
rm -rf tests

- name: Remove unused dependencies from package.json
run: |
node -e "
Expand All @@ -118,7 +122,6 @@ jobs:
// Packages only used in example studies removed from this template.
const unusedDeps = [
'@visdesignlab/upset2-react', // UpSet2 example study only
'arquero', // src/public/tutorial/ brush components only
'topojson-client', // src/public/demo-choropleth-map/ only
// MUI packages — not imported anywhere in src/ on dev branch
'@emotion/react',
Expand Down Expand Up @@ -151,6 +154,9 @@ jobs:
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"

- name: Refresh yarn.lock
run: yarn install --ignore-scripts --non-interactive

- name: Commit and force push to target branch
run: |
git config user.name "github-actions[bot]"
Expand All @@ -161,6 +167,6 @@ jobs:
else
SHORT_SHA="${UPSTREAM_SHA:0:7}"
git commit -m "chore: sync from upstream revisit-studies/study@${SHORT_SHA}"
git push --force origin "$TARGET_BRANCH"
git push --force -- origin "$TARGET_BRANCH"
echo "Force-pushed sync commit to $TARGET_BRANCH."
fi
Loading