diff --git a/.github/workflows/pull_requests_to_csv.yml b/.github/workflows/pull_requests_to_csv.yml index 0ea9261..e25b880 100644 --- a/.github/workflows/pull_requests_to_csv.yml +++ b/.github/workflows/pull_requests_to_csv.yml @@ -7,10 +7,10 @@ on: workflow_dispatch: schedule: - cron: '0 0 * * *' # Runs daily at midnight - pull_request: - types: [opened, closed, reopened] - branches: - - n2020h-issues-to-csv + # pull_request: + # types: [opened, closed, reopened] + # branches: + # - n2020h-issues-to-csv jobs: list-pull-requests: @@ -22,38 +22,35 @@ jobs: uses: actions/checkout@v3 # Set up Node.js to use jq command - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '20' + # - name: Set up Node.js + # uses: actions/setup-node@v3 + # with: + # node-version: '20' # Generate pull requests CSV - name: Generate pull requests CSV run: | - echo "PR Number,Title,Description,Author,State,Number of Commits,Number of Files Changed,Labels,Assignees,Linked Issues,Reviewers" > hackforla_pull_requests.csv - curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/pulls?state=all&per_page=100" | \ - jq -r '[.[] | { - "PR Number": .number, - "Title": .title, - "Description": .body, - "Author": .user.login, - "State": .state, - "Number of Commits": .commits, - "Number of Files Changed": .changed_files, - "Labels": (.labels | map(.name) | join(",")), - "Assignees": (.assignees | map(.login) | join(",")), - "Linked Issues": (.body | capture_all("#(?\\d+)"; "g") | join(",")), - "Reviewers": (.requested_reviewers | map(.login) | join(",")) - }] | (first | keys_unsorted) as $keys | $keys, map([.[ $keys[] ]])[] | @csv' >> hackforla_pull_requests.csv - + run: | + echo "PR Number,Title,Description,Author,State,Number of Commits,Number of Files Changed,Labels,Assignees,Reviewers" > hackforla_PRs.csv + jq -r '.[] | [ + .number, + .title, + .body, + .user.login, + .state, + .commits, + .changed_files, + (.labels | map(.name) | join(",")), + (.assignees | map(.login) | join(",")), + (.requested_reviewers | map(.login) | join(",")) + ] | @csv' pulls.json >> hackforla_PRs.csv # Commit and push the generated CSV to the repository - name: Commit and push CSV run: | git config user.name "Automated" git config user.email "actions@users.noreply.github.com" - git add -f hackforla_pull_requests.csv + git add -f hackforla_PRs.csv timestamp=$(date -u) git commit -m "Latest data: ${timestamp}" || exit 0 git push --force origin HEAD:refs/heads/n2020h-issues-to-csv