Skip to content

Commit 22a0995

Browse files
Enhance contributors workflow with sorting and lazy loading
Sort contributors list and add lazy loading to images
1 parent 72b506a commit 22a0995

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

.github/workflows/contributors.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ name: contributor automation
33
on:
44
schedule: # runs daily at midnight
55
- cron: '0 0 * * *'
6-
push:
6+
pull_request:
7+
types: [closed]
78
branches:
8-
- main # also updates when new pr is merged into the main
9-
workflow_dispatch:
9+
- main
1010

1111
# allows manual trigger
1212
permissions:
1313
contents: write
1414

1515
jobs:
1616
update-readme:
17+
if: github.event_name != 'pull_request' || github.event.pull_request.merged == true
1718
runs-on: ubuntu-latest
1819
steps:
1920
- name: Checkout
@@ -35,14 +36,17 @@ jobs:
3536
PAGE=$((PAGE + 1))
3637
done
3738
# Filters for actual merged PRs and unique users
38-
jq '[.[] | select(.merged_at != null and .user != null and .user.type != "Bot") | .user.login] | unique' final_list.json > contributors.json
39-
39+
jq '[.[]
40+
| select(.merged_at != null and .user != null and .user.type != "Bot")
41+
| .user.login]
42+
| unique
43+
| sort' final_list.json > contributors.json
4044
- name: Build Gallery HTML
4145
run: |
4246
set -euo pipefail
4347
GALLERY_HTML=""
4448
for USERNAME in $(jq -r '.[]' contributors.json); do
45-
GALLERY_HTML="${GALLERY_HTML}<a href=\"https://github.com/${USERNAME}\"><img src=\"https://github.com/${USERNAME}.png\" width=\"50px\" style=\"border-radius:50%;margin:5px;\" alt=\"${USERNAME}\" /></a>"
49+
GALLERY_HTML="${GALLERY_HTML}<a href=\"https://github.com/${USERNAME}\"><img src=\"https://github.com/${USERNAME}.png\" width=\"50px\" loading=\"lazy\" title=\"${USERNAME}\" style=\"border-radius:50%;margin:5px;\" alt=\"${USERNAME}\" /></a>"
4650
done
4751
echo "$GALLERY_HTML" > gallery_fragment.txt
4852

0 commit comments

Comments
 (0)