generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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("#(?<number>\\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 "[email protected]" | ||
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 | ||
|