From ef08eab1a571147a68cc5c152a5efade38669dd2 Mon Sep 17 00:00:00 2001 From: Paul Schultz Date: Tue, 22 Oct 2024 08:53:47 -0500 Subject: [PATCH] chore(gh): add action to update changeset PR (#2412) * chore(gh): add action to update changeset PR Signed-off-by: Paul Schultz * Update .github/workflows/update-changeset-prs.yaml Co-authored-by: Nick Boldt * Update .github/workflows/update-changeset-prs.yaml Co-authored-by: Nick Boldt --------- Signed-off-by: Paul Schultz Co-authored-by: Nick Boldt --- .changeset/sweet-pens-ring.md | 2 + .github/workflows/update-changeset-prs.yaml | 46 +++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .changeset/sweet-pens-ring.md create mode 100644 .github/workflows/update-changeset-prs.yaml diff --git a/.changeset/sweet-pens-ring.md b/.changeset/sweet-pens-ring.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/sweet-pens-ring.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.github/workflows/update-changeset-prs.yaml b/.github/workflows/update-changeset-prs.yaml new file mode 100644 index 00000000000..78275adc7cd --- /dev/null +++ b/.github/workflows/update-changeset-prs.yaml @@ -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