Skip to content
Open
Changes from 3 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
71 changes: 71 additions & 0 deletions .github/workflows/update-dependents.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Update Dependent Repos

on:
release:
types: published
workflow_dispatch:
inputs:
version:
description: "Release version to update dependents"
required: true

permissions:
contents: read

jobs:
update-dependents:
name: Update ${{ matrix.repo }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
repo:
- matlab-actions/run-command
- matlab-actions/run-tests
- matlab-actions/run-build
steps:
- name: Checkout dependent repo
uses: actions/checkout@v6
Comment thread
mw-kapilg marked this conversation as resolved.
Outdated
with:
repository: ${{ matrix.repo }}
token: ${{ secrets.REPOS_ACCESS_TOKEN }}

- uses: actions/setup-node@v6
with:
node-version: 24

- name: Update common-utils dependency
run: |
NEW_VERSION="${{ github.event.release.tag_name || inputs.version }}"

# Update the dependency reference in package.json
sed -i "s|\"common-utils\": \"github:matlab-actions/common-utils#.*\"|\"common-utils\": \"github:matlab-actions/common-utils#${NEW_VERSION}\"|" package.json

# Regenerate package-lock.json with the new version
npm install --package-lock-only

- name: Commit and push changes
run: |
VERSION="${{ github.event.release.tag_name || inputs.version }}"
BRANCH="update-common-utils-${VERSION}"

git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "${BRANCH}"
git add package.json package-lock.json
git commit -m "Bump common-utils to ${VERSION}"
git push origin "${BRANCH}"

- name: Create pull request
env:
GH_TOKEN: ${{ secrets.REPOS_ACCESS_TOKEN }}
run: |
VERSION="${{ github.event.release.tag_name || inputs.version }}"
BRANCH="update-common-utils-${VERSION}"

gh pr create \
--repo ${{ matrix.repo }} \
--base main \
--head "${BRANCH}" \
--title "Bump common-utils to ${VERSION}" \
--body "Automated PR to update \`common-utils\` dependency to [${VERSION}](https://github.com/matlab-actions/common-utils/releases/tag/${VERSION})."