Skip to content

Update dependencies #782

Update dependencies

Update dependencies #782

on:
schedule:
- cron: 23 23 * * 5
pull_request:
types: [opened, reopened, closed]
repository_dispatch:
types: [update-deps]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
name: Update dependencies
jobs:
update:
name: Update npm dependencies
runs-on: ubuntu-latest
timeout-minutes: 10
if: "! startsWith(github.head_ref, 'release/v')"
steps:
- name: Set running flag
run: echo "RUNNING1=" >> $GITHUB_ENV
- name: Set running flag
run: echo "RUNNING1=1" >> $GITHUB_ENV
if: github.event.pull_request.head.user.id == github.event.pull_request.base.user.id
- uses: technote-space/load-config-action@v1
if: env.RUNNING1
with:
CONFIG_FILENAME: workflow-settings.json, workflow-details.json
IGNORE_WARNING: 'true'
- name: Update dependencies
if: env.RUNNING1
id: update_deps
uses: technote-space/create-pr-action@v2
with:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
EXECUTE_COMMANDS: |
npx npm-check-updates -u --packageFile package.json
yarn install
yarn upgrade
yarn audit
COMMIT_MESSAGE: 'chore: update npm dependencies'
PR_DEFAULT_BRANCH_PREFIX: release/
PR_DEFAULT_BRANCH_NAME: next-${CURRENT_VERSION}
PR_DEFAULT_BRANCH_TITLE: 'feat: release'
TARGET_BRANCH_PREFIX: release/
AUTO_MERGE_THRESHOLD_DAYS: 14
- name: Set running flag
run: echo "RUNNING2=" >> $GITHUB_ENV
- name: Set running flag
run: echo "RUNNING2=1" >> $GITHUB_ENV
if: env.RUNNING1 && steps.update_deps.outputs.result != 'succeeded' && github.event_name == 'pull_request' && github.event.action != 'closed' && startsWith(github.head_ref, 'release/')
- uses: actions/checkout@v3
if: env.RUNNING2
- name: Set running flag
run: |
if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then
echo "RUNNING2=" >> $GITHUB_ENV
fi
- name: Sort
run: npx sort-package-json
if: env.RUNNING2
- name: Get version
uses: technote-space/get-next-version-action@v1
with:
EXCLUDE_MESSAGES: ${{ env.EXCLUDE_MESSAGES }}
if: "env.RUNNING2 && ! startsWith(github.head_ref, 'release/v')"
- name: Get version
run: echo "NEXT_VERSION=${HEAD_REF#release/}" >> $GITHUB_ENV
env:
HEAD_REF: ${{ github.head_ref }}
if: env.RUNNING2 && startsWith(github.head_ref, 'release/v')
- name: Check package version
uses: technote-space/package-version-check-action@v1
with:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH_PREFIX: release/
NEXT_VERSION: ${{ env.NEXT_VERSION }}
if: env.NEXT_VERSION