Skip to content

Commit

Permalink
chore(gh): add action to update changeset PR (#2412)
Browse files Browse the repository at this point in the history
* chore(gh): add action to update changeset PR

Signed-off-by: Paul Schultz <pschultz@pobox.com>

* Update .github/workflows/update-changeset-prs.yaml

Co-authored-by: Nick Boldt <nboldt@redhat.com>

* Update .github/workflows/update-changeset-prs.yaml

Co-authored-by: Nick Boldt <nboldt@redhat.com>

---------

Signed-off-by: Paul Schultz <pschultz@pobox.com>
Co-authored-by: Nick Boldt <nboldt@redhat.com>
  • Loading branch information
schultzp2020 and nickboldt authored Oct 22, 2024
1 parent 12074f9 commit f7c6b86
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .changeset/sweet-pens-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
46 changes: 46 additions & 0 deletions .github/workflows/update-changeset-prs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Update changeset PRs (yarn lock regen)

on:
push:
branches:
- 'changeset-release/**'

jobs:
update-and-commit-files:
name: Update and commit files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0

- name: Generate token
id: generate-token
uses: actions/create-github-app-token@31c86eb3b33c9b601a1f60f98dcbfd1d70f379b4 # v1.10.3
with:
app-id: ${{ vars.JANUS_IDP_GITHUB_APP_ID }}
private-key: ${{ secrets.JANUS_IDP_GITHUB_APP_PRIVATE_KEY }}

- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'

- name: Install dependencies
# We want to commit the yarn.lock changes
run: yarn install --no-immutable

- name: Commit changes
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
git config user.name 'janus-idp[bot]'
git config user.email '41898282+janus-idp[bot]@users.noreply.github.com'
git add yarn.lock
if [[ -n $(git status --porcelain) ]]; then
git commit -m 'chore: update yarn.lock'
git push origin HEAD:${{ github.ref }}
fi

0 comments on commit f7c6b86

Please sign in to comment.