@@ -8,41 +8,70 @@ Let's do better not to exclude blind/visually-impaired users from open source!
8
8
9
9
I'll try to make this flexible enough to be usable in any projects.
10
10
11
- ## Inputs
12
11
13
- - ` update_commands ` The command used to update your README or other file
12
+ ## Getting started
14
13
15
- ## Example usage
14
+ - add a shell script to modify your README in ` ./github/update_stats/ `
16
15
17
- You define the actual rewriting functionality. This action just handles doing
18
- the commit for you.
16
+ ie
19
17
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
20
26
```
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
35
32
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
36
50
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 }}
40
53
` ` `
41
54
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
+
42
69
# # Roadmap
43
70
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
46
75
47
76
# # Design aims
48
77
0 commit comments