Skip to content

Commit d985a32

Browse files
committed
update README
1 parent 15b232f commit d985a32

File tree

1 file changed

+53
-24
lines changed

1 file changed

+53
-24
lines changed

README.md

+53-24
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,70 @@ Let's do better not to exclude blind/visually-impaired users from open source!
88

99
I'll try to make this flexible enough to be usable in any projects.
1010

11-
## Inputs
1211

13-
- `update_commands` The command used to update your README or other file
12+
## Getting started
1413

15-
## Example usage
14+
- add a shell script to modify your README in `./github/update_stats/`
1615

17-
You define the actual rewriting functionality. This action just handles doing
18-
the commit for you.
16+
ie
1917

18+
```sh
19+
#!/bin/sh
20+
21+
# replace code coverage % in README into temp file
22+
cat README.md | sed "/Coverage:/ c Coverage: $NEW_COVERAGE" | sed 's/\x1b\[[0-9;]*m//g' > NEWREADME.md
23+
24+
# overwrite README with tempfile
25+
mv NEWREADME.md README.md
2026
```
21-
name: Update project stats in README
22-
on:
23-
push:
24-
branches:
25-
- master
26-
27-
jobs:
28-
update-code-coverage:
29-
runs-on: ubuntu-latest
30-
name: Update project stats
31-
steps:
32-
- uses: actions/checkout@master
33-
- name: Update version
34-
id: update-badges
27+
28+
- add this action within your GitHub Actions workflow:
29+
30+
```yaml
31+
- name: Update project stats
3532
uses: leonstafford/a11y-friendly-badges@master
33+
```
34+
35+
- add a step to do the commit with desired author/message:
36+
37+
```yaml
38+
- name: Commit files
39+
run: |
40+
git config --local user.email "[email protected]"
41+
git config --local user.name "Leon Stafford"
42+
git commit -m "Update project stats" -a || echo "No project stats changes to commit"
43+
```
44+
45+
- add the [ad-m/github-push-action](https://github.com/ad-m/github-push-action) to handle the commit/push
46+
47+
```yaml
48+
- name: Push changes
49+
uses: ad-m/github-push-action@master
3650
with:
37-
update_commands: >
38-
NEW_COVERAGE="$(composer coverage | grep Cov | sed 's/Cov://' | xargs)" &&
39-
sed -i "s/Coverage:/c\Coverage: $NEW_COVERAGE" ./README.md
51+
github_token: ${{ secrets.GITHUB_TOKEN }}
52+
branch: ${{ github.ref }}
4053
```
4154
55+
## Example projects with accessible badges
56+
57+
Inspect these for inspiration:
58+
59+
- [WhatWouldViktorDo](https://github.com/leonstafford/WhatWouldViktorDo)
60+
61+
## Developer pain vs user-empathy
62+
63+
Yes, this will create extra commits in your repo. Yes, you will need to `git pull --rebase` before pushing after a README update.
64+
65+
Is that painful? No, not when considering the alternative is to make your badges useless for the blind/visually impaired.
66+
67+
Suck it up, be an empathetic engineer!
68+
4269
## Roadmap
4370

44-
- store values from other steps in build to use in this action
45-
- override the commit message used
71+
- [x] store values from other steps in build to use in this action
72+
- [x] override the commit message used
73+
- [ ] share library of common stat processing scripts
74+
- [ ] add some shellchecks to the mix
4675

4776
## Design aims
4877

0 commit comments

Comments
 (0)