Skip to content

Commit 8e03a79

Browse files
authored
Merge pull request #212 from derecklhw/main
Fix: workflow featured_issues outputting multiple json objects instead of a json array
2 parents c40a07b + fc9272e commit 8e03a79

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

.github/workflows/featured_issues.yml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,32 @@ name: Fetch Featured Issues
33
on:
44
issues:
55
types: [opened, labeled]
6-
6+
77
jobs:
88
fetch-issues:
99
runs-on: ubuntu-latest
1010

1111
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
2013

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)
2320
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
3523
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

Comments
 (0)