-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (57 loc) · 2.17 KB
/
upgrade-dependencies.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: 'Upgrade (Angular-)Dependencies'
on:
workflow_dispatch:
schedule:
- cron: '10 5 * * SUN'
env:
WORKFLOW_BRANCH: auto-upgrade-dependencies
WORKFLOW_RUN_SIGNATURE: 'By GitHub Action: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
jobs:
auto_upgrade_dependencies:
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
issues: write
steps:
- uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'npm'
- name: Install
env:
HUSKY: 0
run: npm ci --no-fund --no-audit
- name: Verify environment/tools
run: |
node --version
npm --version
npx ng version
npm outdated || true
- name: Prepare git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -B ${{ env.WORKFLOW_BRANCH }}
- name: Upgrade dependencies
run: npm run upgrade:angular
- name: Fix syntax
run: npm run fix
- name: Save updated version(s) and/or syntax changes
env:
HUSKY: 0
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git diff --quiet || (git add --all && git commit -m "fix: Syntax-issues after (Angular-)dependencies upgrade(s) -- ${{ env.WORKFLOW_RUN_SIGNATURE }}")
- name: Create PR/Issue
if: ${{ success() }}
env:
HUSKY: 0
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKFLOW_NEW_PR_URL: '${{ github.server_url }}/${{ github.repository }}/pull/new/${{ env.WORKFLOW_BRANCH }}'
run: |
git push --set-upstream origin ${{ env.WORKFLOW_BRANCH }} --force
gh issue create --title 'Upgrade (Angular-)dependencies (automated)' --body 'Create a new PR with these changes: ${{ env.WORKFLOW_NEW_PR_URL }} -- ${{ env.WORKFLOW_RUN_SIGNATURE }}' --label 'dependencies'