-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (40 loc) · 1.32 KB
/
thank.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Give thanks
on:
workflow_dispatch:
push:
branches: [main]
jobs:
give-thanks:
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Find changed dependencies
id: changed-dependencies
uses: tj-actions/changed-files@v42.0.4
with:
files: |
elm.json
- name: Give thanks!
if: steps.changed-dependencies.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
#!/bin/bash
elm_json='elm.json'
if [ ! -f "$elm_json" ]; then
echo "❌ File not found: $elm_json\n" >&2
exit 1
fi
jq -r '.dependencies.direct + .dependencies.indirect + .["test-dependencies"].direct + .["test-dependencies"].indirect | keys[]' "$elm_json" | while read -r repo; do
gh api -X PUT "user/starred/$repo" --silent
if [ $? -eq 0 ]; then
echo "⭐️ Starred repository: $repo"
else
echo "❌ Failed to star repository $repo ($?).)" >&2
fi
done
echo "🎉 All repositories have been processed."
env:
GITHUB_TOKEN: ${{ secrets.STAR_TOKEN }}