Skip to content

Commit 73356b2

Browse files
authored
Merge pull request #187 from max-programming/readme-update-action
Readme update action
2 parents bfaf6b2 + 398a9ce commit 73356b2

File tree

108 files changed

+640
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+640
-3
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Update Examples List in README
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- "examples/**"
9+
- "techs.json"
10+
11+
jobs:
12+
update-readme:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
ref: ${{ github.head_ref }}
20+
21+
- name: Set up Bun
22+
uses: oven-sh/setup-bun@v2
23+
with:
24+
bun-version: latest
25+
26+
- name: Update README
27+
id: update-readme
28+
run: |
29+
if ! bun run scripts/update-readme.ts; then
30+
echo "README update failed. See details below:"
31+
cat error.log
32+
exit 1
33+
fi
34+
35+
- name: Commit changes
36+
if: success()
37+
run: |
38+
git config --local user.email "[email protected]"
39+
git config --local user.name "GitHub Action"
40+
git add README.md
41+
git commit -m "Update README.md with new examples and technologies" || echo "No changes to commit"
42+
43+
- name: Push changes
44+
if: success()
45+
run: git push origin ${{ github.head_ref }}
46+
47+
- name: Comment on Pull Request if README Update Fails
48+
if: failure()
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
run: |
52+
tech_error=$(cat error.log)
53+
response=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITHUB_TOKEN" \
54+
-X POST \
55+
-d '{"body": "🚨 **README Update Failed**\n\nThe following tech stack(s) were found in examples but do not have entries in `techs.json`. Please add each missing tech in `techs.json` with the following format:\n\n```json\n\"tech-id\": \"Tech Display Name\"\n```\n\nFor example:\n\n```json\n\"nextjs\": \"Next.js\"\n```\n\nMissing Tech(s):\n\n```\n'"$tech_error"'\n```"}' \
56+
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
57+
58+
if [ "$response" -eq 201 ]; then
59+
echo "Comment posted successfully."
60+
else
61+
echo "Failed to post comment. HTTP status: $response"
62+
fi

README.md

Lines changed: 4 additions & 3 deletions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "ImageView",
3+
"tech": "android"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Image SDK",
3+
"tech": "angular"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Cloudinary Upload Widget with an Upload Preset (Unsigned)",
3+
"tech": "angular"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Video Player",
3+
"tech": "angular"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Astro Cloudinary SDK",
3+
"tech": "astro"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Uploading with Forms",
3+
"tech": "astro"
4+
}

examples/astro-image/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Using Astro Image",
3+
"tech": "astro"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Cloudinary Product Gallery",
3+
"tech": "astro"
4+
}

0 commit comments

Comments
 (0)