ant-design/.github/workflows/upgrade-deps.yml
bcd8a7823e
ci: timed check for dependency updates (#45593)
* # This is a combination of 2 commits.
# This is the 1st commit message:

chore: add npm-check-updates

# The commit message #2 will be skipped:

# fixup! chore: add npm-check-updates
(cherry picked from commit f62e034897b7398ba304738433ddbe022147e6c0)

* ci: add upgrade-deps workflow

(cherry picked from commit 0a4a2827b59155757809f80450acfb7e5f63f4b3)

* chore: update rule

* chore: update

* chore: rename

* chore: update
2023-11-03 22:12:46 +08:00

61 lines
1.7 KiB
YAML

name: Upgrade Dependencies
on:
schedule:
- cron: "0 18 * * *" # every day at 18:00 UTC
# - timezone: Asia/Shanghai # not supported yet https://github.com/orgs/community/discussions/13454
jobs:
upgrade-deps:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
permissions:
pull-requests: write # for peter-evans/create-pull-request to create PRs
contents: write # for git push
steps:
- name: checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
.ncurc.js
package.json
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
- name: upgrade deps
id: upgrade
run: |
if [ ! -d .tmp ] ; then
mkdir .tmp
fi
$(npx npm-check-updates -u > .tmp/upgrade-deps-logs.txt) 2>&1 || true
if [ -s .tmp/upgrade-deps-logs.txt ]; then
cat .tmp/upgrade-deps-logs.txt
echo "logs<<EOF" >> $GITHUB_OUTPUT
cat .tmp/upgrade-deps-logs.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: create pull request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }} # Cannot be default!!!
assignees: 'afc163, zombieJ, xrkffgg, MadCcc'
title: "chore: upgrade deps"
commit-message: "chore: upgrade deps"
body: |
Upgrade dependencies
```
${{ steps.upgrade.outputs.logs }}
```
branch: auto-upgrade-deps
delete-branch: true
add-paths: |
package.json