-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy path99-self-healing-dependabot-updates.yml
More file actions
65 lines (57 loc) · 2.33 KB
/
99-self-healing-dependabot-updates.yml
File metadata and controls
65 lines (57 loc) · 2.33 KB
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
name: Auto-Format with Stylelint and Prettier
on:
workflow_call:
jobs:
format:
name: 🆙 Auto-Format
if: ${{ github.actor == 'dependabot[bot]' }}
runs-on: ubuntu-24.04 # Use Ubuntu 24.04 explicitly
permissions:
contents: write
pull-requests: write
steps:
- name: ⏬ Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
- name: 🔍 Check if Stylelint or Prettier update PR
id: check_pr
run: |
echo "PR title: ${{ github.event.pull_request.title }}"
if [[ "${{ github.event.pull_request.title }}" =~ "bump stylelint from" ]] || [[ "${{ github.event.pull_request.title }}" =~ "bump the stylelint group with" ]]; then
echo "Stylelint update detected."
echo "stylelint_update=true" >> $GITHUB_ENV
elif [[ "${{ github.event.pull_request.title }}" =~ "bump prettier from" ]] || [[ "${{ github.event.pull_request.title }}" =~ "bump the prettier group with" ]]; then
echo "Prettier update detected."
echo "prettier_update=true" >> $GITHUB_ENV
else
echo "No Stylelint or Prettier updates detected."
fi
- name: 🆙 Set up Node.js
if: env.stylelint_update == 'true' || env.prettier_update == 'true'
uses: actions/[email protected]
with:
node-version-file: ".nvmrc"
- name: ⏬ Install dependencies
if: env.stylelint_update == 'true' || env.prettier_update == 'true'
run: |
npm ci
- name: 🏃 Run Stylelint to format the code
if: env.stylelint_update == 'true'
run: |
npm run build --workspace=@db-ux/core-stylelint
npm run lint:stylelint -- --fix
- name: 🏃 Run Prettier to format the code
if: env.prettier_update == 'true'
run: |
npm run codestyle
- name: 🚘 Auto commit
if: env.stylelint_update == 'true' || env.prettier_update == 'true'
uses: ./.github/actions/auto-commit
with:
branch-name: "${{ github.head_ref }}-auto"
commit-message: "auto format code"
commit-files: "."
auto-merge-app-id: ${{ vars.AUTO_MERGE_APP_ID }}
auto-merge-private-key: ${{ secrets.AUTO_MERGE_PRIVATE_KEY }}
gh-token: ${{ secrets.GITHUB_TOKEN }}