-
Notifications
You must be signed in to change notification settings - Fork 3.2k
62 lines (51 loc) · 1.57 KB
/
update_readmes.yml
File metadata and controls
62 lines (51 loc) · 1.57 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
name: Update READMEs
on:
push:
branches:
- dev
paths:
- '.github/scripts/listings.json'
workflow_dispatch:
concurrency:
group: listings_update
cancel-in-progress: true
jobs:
run-python-script:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Update READMEs
id: python_script
run: uv run main.py readme update
- name: Set commit message (with fallback)
id: final_commit_message
run: |
msg="${{ steps.python_script.outputs.commit_message }}"
if [ -z "$msg" ]; then
msg="Auto commit: update README"
fi
echo "message=$msg" >> "$GITHUB_OUTPUT"
- name: Commit files
if: success()
run: |
git config --local user.email action@github.com
git config --local user.name 'Github Action'
git add README.md
git diff-index --quiet HEAD || \
git commit -a -m "${{ steps.final_commit_message.outputs.message }}" --allow-empty
- name: Push changes
if: success()
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: dev
- name: Problem With Action
run: echo "There was an error with the github action. ${{ steps.python_script.outputs.error_message }}"
if: failure()