ci: Workflow Bot -- Update ALL Dependencies (main) (#6708) #2856
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ' 🔗 Update Dependencies' | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**/package.json' | |
- '*-lock.yaml' | |
workflow_dispatch: | |
inputs: | |
updateSnapshots: | |
description: 'Update Integration Test snapshots (yes/no)' | |
type: choice | |
options: | |
- 'yes' | |
- 'no' | |
default: 'no' | |
required: true | |
schedule: | |
- cron: '0 12 * * 0' | |
permissions: | |
contents: read | |
env: | |
NEW_BRANCH: 'update-dependencies-main' | |
REF_BRANCH: main | |
patch_path: patch.diff | |
patch_artifact: patch | |
jobs: | |
update-dependencies: | |
if: github.repository_owner == 'streetsidesoftware' | |
runs-on: ubuntu-latest | |
outputs: | |
patch_artifact: ${{ env.patch_artifact }} | |
patch_path: ${{ env.patch_path }} | |
base: ${{ env.REF_BRANCH }} | |
body: | | |
## Update ALL Dependencies (${{ env.REF_BRANCH }}) | |
commit-message: 'ci: Workflow Bot -- Update ALL Dependencies' | |
branch: ${{ env.NEW_BRANCH }} | |
title: 'ci: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})' | |
env: | |
UPDATE_SNAPSHOTS: ${{ github.event.inputs.updateSnapshots == 'yes' || github.event.inputs.updateSnapshots == 'y' }} | |
steps: | |
- name: Start | |
run: | | |
echo "${{ toJson(github.event.inputs) }}" | |
echo "Update Snapshots: $UPDATE_SNAPSHOTS" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.REF_BRANCH }} | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
cache: pnpm | |
- name: Update Root | |
run: | | |
pnpm up | |
pnpm -r up | |
- name: Install | |
run: pnpm install | |
- name: Update Yarn | |
run: | | |
pnpm run update-yarn | |
- name: Has changes | |
run: | | |
git --no-pager diff --compact-summary --exit-code && echo "git_status=clean" >> $GITHUB_ENV || echo "git_status=dirty" >> $GITHUB_ENV | |
git --no-pager diff --compact-summary | |
- name: Build | |
if: (env.UPDATE_SNAPSHOTS == 'true' || env.git_status == 'dirty') | |
run: | | |
pnpm run build | |
- name: Apply and new Lint rules | |
if: env.git_status == 'dirty' | |
continue-on-error: true | |
run: pnpm run lint | |
- name: Update Integration Test Snapshots | |
if: env.UPDATE_SNAPSHOTS == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
pnpm run update-integration-snapshots | |
- name: Build Patch | |
run: | | |
mkdir temp || echo temp already exists | |
git add . | |
git diff HEAD > temp/${{ env.patch_path }} | |
- name: Store Patch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.patch_artifact }} | |
path: temp/${{ env.patch_path }} | |
retention-days: 1 | |
pr: | |
uses: ./.github/workflows/reuseable-pr-from-artifact.yml | |
needs: | |
- update-dependencies | |
with: | |
patch_artifact: ${{ needs.update-dependencies.outputs.patch_artifact }} | |
patch_path: ${{ needs.update-dependencies.outputs.patch_path }} | |
base: ${{ needs.update-dependencies.outputs.base }} | |
body: ${{ needs.update-dependencies.outputs.body }} | |
commit-message: ${{ needs.update-dependencies.outputs.commit-message }} | |
branch: ${{ needs.update-dependencies.outputs.branch }} | |
title: ${{ needs.update-dependencies.outputs.title }} | |
secrets: | |
app_id: ${{ secrets.AUTOMATION_APP_ID }} | |
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} |