-
Notifications
You must be signed in to change notification settings - Fork 142
57 lines (48 loc) · 1.78 KB
/
update-readme.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
name: Update README.md, strings.json, and services.yaml
on:
push:
branches:
- master
paths:
- "README.md"
- "custom_components/adaptive_lighting/const.py"
- "github/workflows/update-readme.yml"
pull_request:
jobs:
update_readme:
runs-on: ubuntu-latest
steps:
- name: Check out code from GitHub
uses: actions/checkout@v3
- name: Install Home Assistant
uses: ./.github/workflows/install_dependencies
with:
python-version: "3.12"
- name: Install markdown-code-runner and README code dependencies
run: |
pip install markdown-code-runner==1.0.0 pandas tabulate
- name: Run markdown-code-runner
run: markdown-code-runner --debug README.md
- name: Run update services.yaml
run: python .github/update-services.py
- name: Run update strings.json
run: python .github/update-strings.py
- name: Commit updated README.md, strings.json, and services.yaml
id: commit
run: |
git add -u .
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
if git diff --quiet && git diff --staged --quiet; then
echo "No changes in README.md, strings.json, and services.yaml, skipping commit."
echo "commit_status=skipped" >> $GITHUB_ENV
else
git commit -m "Update README.md, strings.json, and services.yaml"
echo "commit_status=committed" >> $GITHUB_ENV
fi
- name: Push changes
if: env.commit_status == 'committed'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}