Skip to content

Update amazon-ivs-web-broadcast #30

Update amazon-ivs-web-broadcast

Update amazon-ivs-web-broadcast #30

name: Update amazon-ivs-web-broadcast
on:
schedule:
- cron: '0 8 * * *' # Run every day at 08:00
workflow_dispatch: # Allow manual triggering
jobs:
update-dependency:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
- name: Install Yarn
run: npm install -g yarn
- name: Check for updates
id: check-updates
run: |
# Get current version from package.json (without the ^ character)
CURRENT_VERSION=$(node -p "require('./package.json').dependencies['amazon-ivs-web-broadcast'].replace('^', '')")
echo "Current version: $CURRENT_VERSION"
# Get latest version from npm registry
LATEST_VERSION=$(yarn info amazon-ivs-web-broadcast version --silent)
echo "Latest version: $LATEST_VERSION"
# Compare versions
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
echo "Update available: $CURRENT_VERSION -> $LATEST_VERSION"
echo "has_update=true" >> $GITHUB_OUTPUT
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "new_version=$LATEST_VERSION" >> $GITHUB_OUTPUT
# Update package.json and yarn.lock with new version
yarn add amazon-ivs-web-broadcast@latest
else
echo "No update available"
echo "has_update=false" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.check-updates.outputs.has_update == 'true'
uses: peter-evans/create-pull-request@v6
with:
commit-message: 'chore: update amazon-ivs-web-broadcast to ${{ steps.check-updates.outputs.new_version }}'
title: 'chore: update amazon-ivs-web-broadcast to ${{ steps.check-updates.outputs.new_version }}'
body: |
This PR updates amazon-ivs-web-broadcast from ${{ steps.check-updates.outputs.current_version }} to ${{ steps.check-updates.outputs.new_version }}.
This update was automatically generated by the dependency update workflow.
branch: dependency-update/amazon-ivs-web-broadcast
delete-branch: true