Skip to content

feat(session-flow): suggest /export at session-end moments (0.34.0) #2168

feat(session-flow): suggest /export at session-end moments (0.34.0)

feat(session-flow): suggest /export at session-end moments (0.34.0) #2168

name: dependabot-miro-bundle
# Dependabot bumps plugins/miro/package*.json but cannot regenerate the committed
# dist/index.min.js artifact. This workflow runs on Dependabot PRs, rebuilds when
# the miro manifest changed, and pushes the bundle back to the PR branch (#2083).
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
regenerate-miro-bundle:
# zizmor: ignore[bot-conditions] dependabot-only job; login is read from the PR user, not github.actor
if: github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: write
pull-requests: read
steps:
# Default checkout is the pull_request merge commit, which always
# contains .github/actions/checkout-with-base. Checking out
# github.head_ref first would lose the action on a Dependabot branch
# that has not rebased onto a base that already has it — the runner
# then fails resolving this uses: step and never regenerates the
# bundle. Switch to the PR head after the composite has run so the
# later commit/push still lands on the Dependabot branch.
- name: Check out
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Fetch base
uses: ./.github/actions/checkout-with-base
- name: Switch to PR head
env:
HEAD_REF: ${{ github.head_ref }}
run: |
git fetch --no-tags origin "$HEAD_REF":"refs/remotes/origin/$HEAD_REF"
git checkout -B "$HEAD_REF" "origin/$HEAD_REF"
- name: Detect miro manifest changes
id: scope
env:
BASE_REF: ${{ github.base_ref }}
run: |
if git diff --name-only "origin/$BASE_REF"...HEAD | grep -qE '^plugins/miro/package(-lock)?\.json$'; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- name: Set up Node
if: steps.scope.outputs.changed == 'true'
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: npm
cache-dependency-path: plugins/miro/package-lock.json
- name: Install and regenerate bundle
if: steps.scope.outputs.changed == 'true'
working-directory: plugins/miro
run: |
npm ci
npm run bundle
npm run verify-bundle
- name: Commit regenerated bundle when drifted
if: steps.scope.outputs.changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if git diff --quiet -- plugins/miro/dist/index.min.js; then
echo "dist already matches source — nothing to commit"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add plugins/miro/dist/index.min.js
git commit -m "chore(miro): regenerate dist for dependabot manifest bump"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git push