Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
f1bf7bc
Create issues-to-csv.yml
n2020h Feb 12, 2024
9fe15bc
Update issues-to-csv.yml
n2020h Feb 13, 2024
ea64d92
Update issues-to-csv.yml
n2020h Feb 13, 2024
26789e4
Add generate csv.yml
n2020h Feb 13, 2024
3368204
Removed if statement.yml
n2020h Feb 13, 2024
0fca665
Debug uses statement.yml
n2020h Feb 13, 2024
cd705b9
Simplified workflow
n2020h Feb 26, 2024
4e2936a
add new manual trigger
n2020h Feb 26, 2024
a81859d
add scheduler for testing
n2020h Feb 26, 2024
e51f2c5
update script to bypass gitignore and add file to repo on branch
n2020h Feb 27, 2024
a41128a
force push to feature branch
n2020h Feb 27, 2024
e96c077
Merge a41128ad57113796168594c069da519d83fed0f2 into 12807299c2a93b447…
n2020h Feb 27, 2024
0963a4e
Latest data: Tue Feb 27 02:45:12 UTC 2024
Feb 27, 2024
f491475
Update issues-to-csv to add more fields.yml
n2020h Jul 22, 2024
36f4b15
Update issues-to-csv.yml
n2020h Jul 22, 2024
c62826b
Latest data: Mon Jul 22 20:49:10 UTC 2024
Jul 22, 2024
2ba5e53
Update issues-to-csv removed fields.yml
n2020h Jul 22, 2024
0bd573f
Latest data: Mon Jul 22 21:02:13 UTC 2024
Jul 22, 2024
e3a668a
Create pull_requests_to_csv.yml
n2020h Jul 22, 2024
ea2b851
Debug pull_requests_to_csv.yml
n2020h Jul 23, 2024
f7098af
Update node.js
n2020h Jul 23, 2024
8a3fd1e
Update GH token
n2020h Jul 23, 2024
a0d7f3d
Debug pull_requests_to_csv.yml
n2020h Jul 23, 2024
2b17fbb
Update pull_requests_to_csv.yml
n2020h Jul 23, 2024
925e5ff
Debug & breakpoint pull_requests_to_csv.yml
n2020h Jul 29, 2024
d730c20
Removed dependabot details.yml
n2020h Jul 29, 2024
488b0bd
Latest data: Mon Jul 29 17:07:19 UTC 2024
Jul 29, 2024
57aad64
Update pull_requests_to_csv.yml
n2020h Jul 29, 2024
c933e92
Update pull_requests_to_csv.yml
n2020h Jul 29, 2024
5df86a4
Latest pull requests data: Mon Jul 29 22:40:16 UTC 2024
Jul 29, 2024
25c5256
Update pull_requests_to_csv.yml
n2020h Jul 29, 2024
c6fc3d1
Latest pull requests data: Mon Jul 29 22:47:53 UTC 2024
Jul 29, 2024
2f9bcb8
Update pull_requests_to_csv.yml
n2020h Aug 7, 2024
6248bb7
Latest pull requests data: Wed Aug 7 01:18:35 UTC 2024
Aug 7, 2024
f93fc37
Add Linked Issues.yml
n2020h Aug 7, 2024
ba42f8f
Update pull_requests_to_csv.yml
n2020h Aug 7, 2024
6f934ba
Update pull_requests_to_csv.yml
n2020h Aug 7, 2024
7eb0ec4
Latest pull requests data: Wed Aug 7 02:47:40 UTC 2024
Aug 7, 2024
892a336
Update pull_requests_to_csv.yml
n2020h Aug 12, 2024
da35cd0
Update pull_requests_to_csv.yml
n2020h Aug 12, 2024
66e06d9
Latest pull requests data: Mon Aug 12 21:16:51 UTC 2024
Aug 12, 2024
807e2f0
Update pull_requests_to_csv.yml
n2020h Aug 12, 2024
20a3fae
Latest pull requests data: Mon Aug 12 21:22:35 UTC 2024
Aug 12, 2024
314b518
Update pull_requests_to_csv.yml
n2020h Aug 12, 2024
75b87d5
Latest pull requests data: Mon Aug 12 21:28:03 UTC 2024
Aug 12, 2024
e595741
Update pull_requests_to_csv.yml
n2020h Aug 12, 2024
74af139
Add more linked issues.yml
n2020h Aug 26, 2024
06265c4
Latest data: Mon Aug 26 02:50:17 UTC 2024
Aug 26, 2024
635d295
Adding linked issues.yml
n2020h Aug 26, 2024
c5ffc24
Latest pull requests data: Mon Aug 26 02:57:01 UTC 2024
Aug 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/issues-to-csv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: List Issues and Output as CSV

on:
push:
branches:
- n2020h-issues-to-csv
workflow_dispatch:
schedule:
- cron: '*/5 * * * *'
issues:
types: [opened, closed, reopened]
pull_request:
types: [opened, closed, reopened]
branches:
- n2020h-issues-to-csv


jobs:
list-issues:
runs-on: ubuntu-latest
steps:
# Checkout the repo to access any scripts or tools you might need
- name: Checkout repository
uses: actions/checkout@v3

# Generate issues CSV
# - name: Generate issues CSV
# run: |
# echo "Issue Number,Title,Labels" > issues.csv
# curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
# "https://api.github.com/repos/${{ github.repository }}/issues?state=all&per_page=100" | \
# jq -r '.[] | select(.pull_request == null) | [.number, .title, (.labels | map(.name) | join(","))] | @csv' >> issues.csv
- name: Generate issues CSV
run: |
echo "Issue Number,Title,Labels,State,User Login,User ID,Assignee Login,Assignee ID" > issues.csv
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues?state=all&per_page=100" | \
jq -r '.[] | select(.pull_request == null) | [
.number,
.title,
(.labels | map(.name) | join(",")),
.state,
.user.login,
.user.id,
(.assignee | if . != null then .login else "None" end),
(.assignee | if . != null then .id else "None" end)
] | @csv' >> issues.csv
# Generate issues CSV

- name: Commit and push
run: |
git config user.name "Automated"
git config user.email "[email protected]"
git add -f issues.csv
timestamp=$(date -u)
git commit -m "Latest data: ${timestamp}" || exit 0
git push --force origin HEAD:refs/heads/n2020h-issues-to-csv

# # Upload CSV as artifact
# - name: Upload CSV as artifact
# uses: actions/upload-artifact@v2
# with:
# name: issues-csv
# path: issues.csv


# name: issues-csv
# path: issues.csv
244 changes: 244 additions & 0 deletions .github/workflows/pull_requests_to_csv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
name: List Pull Requests and Output as CSV

on:
push:
branches:
- n2020h-issues-to-csv
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight

jobs:
list-pull-requests:
runs-on: ubuntu-latest

steps:
# Checkout the repository to access any scripts or tools you might need
- name: Checkout repository
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'

# Fetch pull requests data and save it to pulls.json
- name: Fetch pull requests data
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/pulls?state=all&per_page=100" \
-o pulls.json

# Fetch linked issues for each PR
- name: Fetch linked issues for each PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for pr_number in $(jq -r '.[].number' pulls.json); do \
curl -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/issues/$pr_number/timeline?per_page=100" \
-o "timeline_$pr_number.json"; \
done

# Debugging: Display timeline JSON for a PR
- name: Display timeline JSON content for a PR
run: cat timeline_*.json


# # Generate pull requests CSV including linked issues
# - name: Generate pull requests CSV including linked issues
# run: |
# echo "PR Number,Title,Author,State,Labels,Assignees,Reviewers,Linked Issues" > pull_requests.csv

# for pr_number in $(jq -r '.[].number' pulls.json); do
# timeline_file="timeline_$pr_number.json"

# # Ensure the timeline file is not empty before processing
# if [ -s "$timeline_file" ]; then
# linked_issues=$(jq -r '[.[] | select(.event == "cross-referenced" and .source.issue) | .source.issue.number | tostring] | join(", ")' "$timeline_file")
# else
# linked_issues=""
# fi

# jq -r --arg linked_issues "$linked_issues" \
# '.[] | select(.number == '$pr_number') | [
# .number,
# .title,
# .user.login,
# .state,
# (.labels | map(.name) | join(",")),
# (.assignees | map(.login) | join(",")),
# (.requested_reviewers | map(.login) | join(",")),
# $linked_issues
# ] | @csv' pulls.json >> pull_requests.csv
# done
- name: Generate pull requests CSV including linked issues and has_issues
run: |
echo "PR Number,Title,Description,Author,State,Number of Commits,Number of Files Changed,Labels,Assignees,Reviewers,Linked Issues,Has Issues" > pull_requests.csv

for pr_number in $(jq -r '.[].number' pulls.json); do
timeline_file="timeline_$pr_number.json"

if [ -f "$timeline_file" ]; then
linked_issues_timeline=$(jq -r '[.[] | select(.event == "cross-referenced" and .source.issue) | .source.issue.url | capture("/(?<issue_number>\\d+)$").issue_number] | join(", ")' "$timeline_file")
else
linked_issues_timeline=""
fi

linked_issues_body=$(jq -r '.[] | select(.number == '$pr_number') | .body | capture_all("#(?<number>\\d+)"; "g") | join(",")' pulls.json || echo "")

linked_issues_reactions=$(jq -r '.[] | select(.number == '$pr_number') | .reactions.url | capture("/issues/(?<issue_number>\\d+)/reactions").issue_number' pulls.json || echo "")

linked_issues_direct=$(jq -r '.[] | select(.number == '$pr_number') | .issue_url | capture("/issues/(?<issue_number>\\d+)$").issue_number' pulls.json || echo "")

linked_issues=$(echo "$linked_issues_timeline, $linked_issues_body, $linked_issues_reactions, $linked_issues_direct" | sed 's/^, //; s/, $//; s/,,/,/g')

has_issues=$(jq -r '.repository.has_issues' pulls.json || echo "false")

jq -r --arg linked_issues "$linked_issues" --arg has_issues "$has_issues" \
'.[] | select(.number == '$pr_number') | [
.number,
.title,
.body,
.user.login,
.state,
.commits,
.changed_files,
(.labels | map(.name) | join(",")),
(.assignees | map(.login) | join(",")),
(.requested_reviewers | map(.login) | join(",")),
$linked_issues,
$has_issues
] | @csv' pulls.json >> pull_requests.csv
done

# Check the content of pull_requests.csv for debugging
- name: Display pull_requests.csv content
run: cat pull_requests.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 pull_requests.csv
timestamp=$(date -u)
git commit -m "Latest pull requests data: ${timestamp}" || exit 0
git push --force origin HEAD:refs/heads/n2020h-issues-to-csv
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


##------------------------------------------##
# name: List Pull Requests and Output as CSV

# on:
# push:
# branches:
# - n2020h-issues-to-csv
# workflow_dispatch:
# schedule:
# - cron: '0 0 * * *' # Runs daily at midnight
# # pull_request:
# # types: [opened, closed, reopened]
# # branches:
# # - n2020h-issues-to-csv
# jobs:
# list-pull-requests:
# runs-on: ubuntu-latest

# steps:
# # Checkout the repository to access any scripts or tools you might need
# - name: Checkout repository
# 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'
# # Fetch pull requests data and save it to pulls.json
# - name: Fetch pull requests data
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# curl -H "Authorization: token $GITHUB_TOKEN" \
# -H "Accept: application/vnd.github.v3+json" \
# "https://api.github.com/repos/${{ github.repository }}/pulls?state=all&per_page=100" \
# -o pulls.json

# # Check the content of pulls.json for debugging
# - name: Display pulls.json content
# run: cat pulls.json

# # Generate pull requests CSV
# # (.body | capture_all("#(?<number>\\d+)"; "g") | join(","))
# - name: Generate pull requests CSV
# run: |
# echo "PR Number,Title,Description,Author,State,Number of Commits,Number of Files Changed,Labels,Assignees,Reviewers, Linked Issues" > pull_requests.csv
# jq -r '.[] | select(.user.login != "dependabot[bot]") | [
# .number,
# .title,
# .body,
# .user.login,
# .state,
# .commits,
# .changed_files,
# (.labels | map(.name) | join(",")),
# (.assignees | map(.login) | join(",")),
# (.requested_reviewers | map(.login) | join(",")),
# (if .body != null then .body | gsub("#";" ") | split(" ") | map(select(startswith("issue_number"))) | join(",") else "" end)
# ] | @csv' pulls.json >> pull_requests.csv

# # Check the content of pull_requests.csv for debugging
# - name: Display pull_requests.csv content
# run: cat pull_requests.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 pull_requests.csv
# timestamp=$(date -u)
# git commit -m "Latest pull requests data: ${timestamp}" || exit 0
# git push --force origin HEAD:refs/heads/n2020h-issues-to-csv
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

####-------------------------------------------------#######

# # Generate pull requests CSV
# - name: Generate pull requests CSV
# run: |
# 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_PRs.csv
# timestamp=$(date -u)
# git commit -m "Latest data: ${timestamp}" || exit 0
# git push --force origin HEAD:refs/heads/n2020h-issues-to-csv
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading