Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(workflows): create a shared workflow for update-please #27

Merged
merged 9 commits into from
Apr 25, 2024
68 changes: 68 additions & 0 deletions .github/workflows/update-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Update Please

on:
workflow_call:
inputs:
reviewers:
type: string
description: A comma-separated list of reviewers (GitHub usernames) to request a review from.
required: false
team-reviewers:
type: string
description: A comma-separated list of GitHub teams to request a review from.
required: false
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

permissions:
contents: write
pull-requests: write

jobs:
update-please:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- 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 minor and patch dependencies
run: ncu -t minor -u
env:
NODE_AUTH_TOKEN: ${{ secrets.READONLY_NPM_TOKEN }}

- name: Install updated dependencies
run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.READONLY_NPM_TOKEN }}

- name: Create Pull Request
uses: hedia-team/create-pull-request@v6
with:
token: ${{ secrets.HEDIA_BOT_GITHUB_PAT }}
commit-message: "chore(deps): update dependencies"
title: "chore(deps): update dependencies"
body: "Update Please has found one or more dependencies to be updated! 🚀"
branch: update-please-${{ github.sha }}
labels: chore
reviewers: ${{ inputs.reviewers }}
team-reviewers: ${{ inputs.team-reviewers }}