Create issues-to-csv.yml #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: List Issues and Output as CSV | |
on: | |
pull_request: | |
issues: | |
types: [opened, transferred, assigned] | |
jobs: | |
list-issues: | |
runs-on: ubuntu-latest | |
steps: | |
- name: List Issues for Repository | |
id: list_issues | |
run: | | |
echo "issue_id,issue_title,issue_state" > issues.csv | |
PAGE=1 | |
while :; do | |
RESPONSE=$(gh api repos/$ORGANIZATION/website/issues -f state=all -f per_page=100 -f page=$PAGE) | |
echo "$RESPONSE" | jq -r '.[] | "\(.id),\(.title),\(.state)"' >> issues.csv | |
COUNT=$(echo "$RESPONSE" | jq length) | |
if [ "$COUNT" -lt 100 ]; then | |
break | |
fi | |
((PAGE++)) | |
done | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ORGANIZATION: 'hackforla' | |
- name: Upload CSV as Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: issues.csv | |
path: issues.csv |