Skip to content

Update Please

Update Please #3

Workflow file for this run

name: Update Please
on:
workflow_call:
inputs:
target:
type: string
description: Target versions to upgrade to. For example, "latest", "minor" or "patch".
default: minor
secrets:
HEDIA_BOT_GITHUB_PAT:
description: Needed to create the PR
required: true
READONLY_NPM_TOKEN:
description: Needed to access private @hedia npm packages
required: true
workflow_dispatch:
inputs:
topic:
type: choice
description: Repositories tagged with this topic will be updated
required: true
default: backend
options:
- app
- backend
- dev
- io
- module
- org
- platform
- runtime
- service
- test
target:
type: choice
description: Target versions to upgrade to
required: true
options:
- latest
- minor
- patch
permissions:
contents: write
pull-requests: write
jobs:
update-please:
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.event.repository.name != '.github'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
token: ${{ secrets.HEDIA_BOT_GITHUB_PAT }}
- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
always-auth: true
cache: "npm"
node-version-file: package.json
registry-url: https://registry.npmjs.org
scope: "@hedia"
- name: Install npm-check-updates
run: npm install -g npm-check-updates
- name: Update ${{ inputs.target || 'minor' }} dependencies
run: ncu -t ${{ inputs.target || 'minor' }} -u --install always
env:
NODE_AUTH_TOKEN: ${{ secrets.READONLY_NPM_TOKEN }}
- id: create-pull-request
name: Create Pull Request
uses: hedia-team/.github/.github/actions/create-pull-request@main
with:
auto-merge: true
base: ${{ github.ref_name }}
body: "Update Please has found one or more dependencies to be updated! 🚀"
force: true
github-token: ${{ secrets.HEDIA_BOT_GITHUB_PAT }}
head: "update-please-${{ github.ref_name }}"
title: "chore(deps): update dependencies"
- name: Assign Actor
run: gh pr edit --add-assignee ${{ github.event_name == 'workflow_dispatch' && github.actor || 'hedia-bot' }}
env:
GH_TOKEN: ${{ secrets.HEDIA_BOT_GITHUB_PAT }}
run-update-please:
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.event.repository.name == '.github'
steps:
- name: Run Update Please
run: |
urls=$(gh repo list hedia-team --limit 1000 --topic=${{ inputs.topic }} --no-archived --json=url --jq=".[] | .url")
echo "Running Update Please for the following repos:"
for url in $urls
do
echo "* $url"
gh workflow run --repo $url --raw-field target=${{ inputs.target }} update-please.yml || true
done
echo " "
echo "Feel free to approve the PRs created by update-please once the checks have passed using approve-please!"
echo "https://github.com/hedia-team/.github/actions/workflows/approve-please.yml"
env:
GH_TOKEN: ${{ secrets.HEDIA_BOT_GITHUB_PAT }}