Skip to content

Commit f9b58c9

Browse files
authored
fix(featured-issues): no commit if no changes (#206)
1 parent aa300ef commit f9b58c9

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

.github/workflows/featured_issues.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,33 @@ name: Fetch Featured Issues
33
on:
44
issues:
55
types: [opened, labeled]
6-
pull_request:
7-
types:
8-
- opened
9-
- updated
106

117
jobs:
128
fetch-issues:
139
runs-on: ubuntu-latest
14-
10+
1511
steps:
1612
- uses: actions/checkout@v2
17-
13+
1814
- name: Fetch Featured Issues
1915
env:
2016
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2117
run: |
2218
# Fetch all open issues labeled as "featured"
23-
issues=$(gh issue list --limit 1000 --state open --label "featured" --json number,title,url)
24-
25-
# Save the issues to a featured-issues.json
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}')
20+
21+
# Save the issues to a featured-issues.json
2622
echo "$issues" | jq > packages/frontendmu-data/data/featured-issues.json
27-
28-
# Commit the changes
29-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
30-
git config --local user.name "GitHub Action[bot]"
31-
git add packages/frontendmu-data/data/featured-issues.json
32-
git commit -m "Update featured issues"
33-
git push
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
35+

0 commit comments

Comments
 (0)