Skip to content

Commit 037afce

Browse files
authored
Merge pull request #3 from makersmakingchange/add-update-about-mmc-github-action
Add Update About MMC GitHub Action
2 parents 30d2c47 + 36a2be5 commit 037afce

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Update About MMC Section
2+
# This GitHub Action will update the About Makers Making Change section of the Readme.md
3+
# from the Makers-Making-Change repository readme.
4+
5+
# It replace everything in the Readme.md file between the tags <!-- ABOUT MMC START --> and
6+
# <!-- ABOUT MMC END -->
7+
8+
# It is triggered manually through the GitHub Actions in the repository.
9+
# Last updated: 2025-Apr-08
10+
on:
11+
workflow_dispatch: # Enables manual trigger via the Actions tab
12+
13+
jobs:
14+
update-about:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout this repo
19+
uses: actions/checkout@v3
20+
21+
- name: Fetch shared About MMC section
22+
run: |
23+
curl -s https://raw.githubusercontent.com/makersmakingchange/Makers-Making-Change/refs/heads/main/ABOUT_MMC.md -o about.md
24+
25+
- name: Replace About MMC section in README
26+
run: |
27+
if [ ! -f README.md ]; then
28+
echo "README.md not found!"
29+
exit 1
30+
fi
31+
32+
awk '
33+
BEGIN { inside=0 }
34+
/<!-- ABOUT MMC START -->/ {
35+
print
36+
system("cat about.md")
37+
inside=1
38+
next
39+
}
40+
/<!-- ABOUT MMC END -->/ {
41+
inside=0
42+
print
43+
next
44+
}
45+
inside == 0 {
46+
print
47+
}
48+
' README.md > temp.md
49+
50+
mv temp.md README.md
51+
52+
- name: Commit and push changes
53+
run: |
54+
git config user.name "github-actions"
55+
git config user.email "github-actions@github.com"
56+
57+
git add README.md
58+
git diff --cached --quiet || (git commit -m "Update About MMC Section" && git push)

0 commit comments

Comments
 (0)