@@ -3,33 +3,32 @@ name: Fetch Featured Issues
3
3
on :
4
4
issues :
5
5
types : [opened, labeled]
6
-
6
+
7
7
jobs :
8
8
fetch-issues :
9
9
runs-on : ubuntu-latest
10
10
11
11
steps :
12
- - uses : actions/checkout@v2
13
-
14
- - name : Fetch Featured Issues
15
- env :
16
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
17
- run : |
18
- # Fetch all open issues labeled as "featured"
19
- issues=$(gh issue list --limit 1000 --state open --label "featured" --json number,title,url,author,assignees,createdAt,state,comments | jq '.[] | {number, title, url, author, assignees, createdAt, state, comments_count: .comments | length}')
12
+ - uses : actions/checkout@v2
20
13
21
- # Save the issues to a featured-issues.json
22
- echo "$issues" | jq > packages/frontendmu-data/data/featured-issues.json
14
+ - name : Fetch Featured Issues
15
+ env :
16
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
17
+ run : |
18
+ # Fetch all open issues labeled as "featured"
19
+ issues=$(gh issue list --limit 1000 --state open --label "featured" --json number,title,url,author,assignees,createdAt,state,comments)
23
20
24
- # Check if there are any changes
25
- if [ -n "$(git status --porcelain packages/frontendmu-data/data/featured-issues.json)" ]; then
26
- # Commit and push changes if the file has been modified
27
- git config --local user.email "github-actions[bot]@users.noreply.github.com"
28
- git config --local user.name "GitHub Action[bot]"
29
- git add packages/frontendmu-data/data/featured-issues.json
30
- git commit -m "Update featured issues"
31
- git push
32
- else
33
- echo "No changes detected in featured-issues.json. Skipping commit."
34
- fi
21
+ # Save the issues to a featured-issues.json
22
+ echo "$issues" | jq 'map({number, title, url, author, assignees, createdAt, state, comments_count: .comments | length})' > packages/frontendmu-data/data/featured-issues.json
35
23
24
+ # Check if there are any changes
25
+ if [ -n "$(git status --porcelain packages/frontendmu-data/data/featured-issues.json)" ]; then
26
+ # Commit and push changes if the file has been modified
27
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
28
+ git config --local user.name "GitHub Action[bot]"
29
+ git add packages/frontendmu-data/data/featured-issues.json
30
+ git commit -m "Update featured issues"
31
+ git push
32
+ else
33
+ echo "No changes detected in featured-issues.json. Skipping commit."
34
+ fi
0 commit comments