2023-01-06 13:44:04 +00:00
|
|
|
name: " 🔗 Update Dependencies Main"
|
2023-01-05 08:02:08 +00:00
|
|
|
|
|
|
|
on:
|
2023-01-06 13:44:04 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2023-01-05 08:02:08 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
schedule:
|
2023-01-06 13:44:04 +00:00
|
|
|
- cron: "0 12 * * 0"
|
2023-01-05 08:02:08 +00:00
|
|
|
|
|
|
|
jobs:
|
2023-01-06 13:44:04 +00:00
|
|
|
update-dependencies:
|
2023-01-05 08:02:08 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-01-06 13:44:04 +00:00
|
|
|
env:
|
|
|
|
NEW_BRANCH: "update-dependencies-main"
|
|
|
|
REF_BRANCH: main
|
2023-01-05 08:02:08 +00:00
|
|
|
steps:
|
2023-01-06 13:44:04 +00:00
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
ref: ${{ env.REF_BRANCH }}
|
2023-01-05 08:02:08 +00:00
|
|
|
|
2023-01-06 13:44:04 +00:00
|
|
|
- uses: actions/setup-node@v3
|
2023-01-05 08:02:08 +00:00
|
|
|
with:
|
2023-01-06 13:44:04 +00:00
|
|
|
cache: yarn
|
2023-01-05 08:02:08 +00:00
|
|
|
|
2023-01-06 13:44:04 +00:00
|
|
|
- name: Update
|
|
|
|
run: |
|
|
|
|
yarn
|
|
|
|
yarn upgrade
|
|
|
|
- name: update package.json
|
|
|
|
run: |
|
|
|
|
npx package-json-dependency-updater -u
|
|
|
|
- name: Install
|
|
|
|
run: |
|
|
|
|
yarn
|
2023-01-05 08:02:08 +00:00
|
|
|
|
2023-01-06 13:44:04 +00:00
|
|
|
- name: Lint
|
|
|
|
run: |
|
|
|
|
yarn lint
|
|
|
|
- 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: Gen Body
|
|
|
|
run: |
|
|
|
|
echo 'git_body<<DIFF' >> $GITHUB_ENV
|
|
|
|
git --no-pager diff --compact-summary >> $GITHUB_ENV
|
|
|
|
echo 'DIFF' >> $GITHUB_ENV
|
|
|
|
- name: Echo git_status
|
|
|
|
run: echo ${{ env.git_status }}
|
|
|
|
- uses: tibdex/github-app-token@v1.7 # cspell:ignore tibdex
|
|
|
|
if: env.git_status == 'dirty'
|
|
|
|
id: generate-token
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.AUTOMATION_APP_ID }}
|
|
|
|
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
|
2023-01-05 08:02:08 +00:00
|
|
|
- name: Create Pull Request
|
2023-01-06 13:44:04 +00:00
|
|
|
if: env.git_status == 'dirty'
|
|
|
|
uses: peter-evans/create-pull-request@v4
|
2023-01-05 08:02:08 +00:00
|
|
|
with:
|
2023-01-06 13:44:04 +00:00
|
|
|
commit-message: "ci: Workflow Bot -- Update ALL Dependencies"
|
|
|
|
branch: ${{ env.NEW_BRANCH }}
|
|
|
|
base: ${{ env.REF_BRANCH }}
|
|
|
|
title: "ci: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})"
|
|
|
|
token: ${{ steps.generate-token.outputs.token }}
|
|
|
|
body: ${{ env.git_body }}
|
|
|
|
delete-branch: true
|
|
|
|
|