Skip to content

Commit

Permalink
feat(workflows): create a shared workflow for update-please (#27)
Browse files Browse the repository at this point in the history
* feat(workflows): add a workflow to update dependencies

* fix(workflows): use NODE_AUTH_TOKEN for ncu

* fix(workflows): add the NODE_AUTH_TOKEN for install, too

* ci(workflows): improve body, branch and labels

* ci(workflows): add reviewers as an input option

* ci(workflows): rename the workflow to update-please

* ci(workflows): it seems team-reviewers are handled separately from github username reviewers

* ci(workflows): be accurate that it's one or more dependencies (we actually don't know)

* ci(workflows): use a hedia-fork of create-pull-request action

thanks for everything you did, peter-evans
  • Loading branch information
aimeerivers authored Apr 25, 2024
1 parent 144d8e1 commit 9eacfde
Showing 1 changed file with 68 additions and 0 deletions.
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 }}

0 comments on commit 9eacfde

Please sign in to comment.