Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added workflow to create issue_report.json (tracks issues with hashes) #20

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0b4c23a
moved issues_report.md to out directory
IDCs Oct 28, 2024
1ac1770
added error handling
IDCs Oct 28, 2024
e15136c
generating json instead of md
IDCs Oct 28, 2024
8c2a73f
added json validation
IDCs Oct 28, 2024
b9dad80
removing jq calls
IDCs Oct 28, 2024
1f30387
issue generation is now run through a script
IDCs Oct 29, 2024
17b9b0a
fixed yaml syntax issue
IDCs Oct 29, 2024
9b80c06
modified github issue update script
IDCs Oct 29, 2024
87f1d40
fixed some type related issues
IDCs Oct 29, 2024
0cfabcb
Update Github Issues
insomnious Oct 29, 2024
d6329c1
improved issue filter + cleanup
IDCs Oct 29, 2024
987e544
Update Github Issues
insomnious Oct 29, 2024
6e9a7cd
more cleanup
IDCs Oct 29, 2024
196a21d
Update Github Issues
insomnious Oct 29, 2024
541af8f
fixed issue skip logging
IDCs Oct 29, 2024
9a49a54
Update Github Issues
insomnious Oct 29, 2024
3771364
final tweaks
IDCs Oct 29, 2024
9346124
added hash generation based on error message and stack
IDCs Oct 29, 2024
83c97bf
filter out issues without a body
IDCs Oct 29, 2024
b1f947c
Update Github Issues
insomnious Oct 29, 2024
3a6ac43
do not generate hash for issues with no errormessage|stack
IDCs Oct 29, 2024
8ae782c
Update Github Issues
insomnious Oct 29, 2024
8a13397
modified issue updater to match the old grouping keys
IDCs Nov 6, 2024
1209270
Update Github Issues
insomnious Nov 6, 2024
992b904
Update Github Issues
insomnious Nov 6, 2024
9db4e3a
simplified hash generation
IDCs Nov 6, 2024
33631ce
Removing debug leftovers
IDCs Nov 25, 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
126 changes: 49 additions & 77 deletions .github/workflows/update-issue-tracker.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,62 @@
name: Daily Open and Closed Issues Check
name: Update Github Issues

# This workflow is triggered every 24 hours
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to update'
required: true
default: 'main'

schedule:
- cron: "0 0 * * *" # Runs daily at midnight UTC
- cron: '0 0 * * *'

jobs:
fetch_issues:
runs-on: ubuntu-latest
Update-Github-Issues:
runs-on: ubuntu-latest

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Fetch open issues from the repository
id: fetch_open_issues
- name: Show Inputs
run: |
# Fetch open issues using GitHub API
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/nexus-mods/vortex/issues?state=open" > open_issues.json

# Show fetched open issues
cat open_issues.json
echo "Selected branch: ${{ github.event.inputs.branch }}"

- name: Fetch closed issues from the repository (last 30 days)
id: fetch_closed_issues
run: |
# Calculate the date 30 days ago
last_month=$(date -d "-30 days" +%Y-%m-%d)
- uses: actions/checkout@v4
with:
submodules: "recursive"
ref: ${{ github.event.inputs.branch }} # Checkout the specified branch

# Fetch closed issues using GitHub API with the 'since' parameter to get those closed in the last month
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/nexus-mods/vortex/issues?state=closed&since=$last_month" > closed_issues.json

# Show fetched closed issues
cat closed_issues.json

- name: Process issues, extract hashes, and log the report
- name: Validate branch exists
run: |
echo "Processing open and closed issues (excluding issues by vortexfeedback):"
echo "# Open and Closed Issues on "nexus-mods/vortex" (Updated on $(date))" > issues_report.md

process_issues() {
issues_file=$1

for row in $(jq -c '.[]' $issues_file); do
author=$(echo $row | jq -r '.user.login')

# Ignore issues by vortexfeedback
if [ "$author" = "VortexFeedback" ]; then
echo "Skipping issue by vortexfeedback"
continue
fi

issue_number=$(echo $row | jq '.number')
issue_title=$(echo $row | jq '.title' | sed 's/\"//g')
issue_url=$(echo $row | jq '.html_url' | sed 's/\"//g')
issue_body=$(echo $row | jq '.body' | sed 's/\"//g')
issue_state=$(echo $row | jq '.state' | sed 's/\"//g')
issue_labels=$(echo $row | jq -r '.labels[].name' | tr '\n' ',' | sed 's/,$//')

# Extract the hash value from the issue body if present
issue_hash=$(echo "$issue_body" | grep -oP '(?<=hash: ).*' || echo "No hash found")

echo "- [Issue #$issue_number: $issue_title]($issue_url)" >> issues_report.md
echo " - State: $issue_state" >> issues_report.md
echo " - Labels: $issue_labels" >> issues_report.md
echo " - Hash: $issue_hash" >> issues_report.md
echo "---" >> issues_report.md
done
}

# Process both open and closed issues
process_issues open_issues.json
process_issues closed_issues.json

- name: Commit the results
git fetch --all
if ! git rev-parse --verify "origin/${{ github.event.inputs.branch }}" > /dev/null 2>&1; then
echo "Branch '${{ github.event.inputs.branch }}' does not exist."
exit 1
fi

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: "yarn"

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run
run: yarn update-github-issues

- name: Git commit and push
env:
CI_COMMIT_AUTHOR: Vortex Backend
CI_COMMIT_EMAIL: [email protected]
CI_COMMIT_MESSAGE: Update Github Issues
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add issues_report.md
git commit -m "Update open and closed issues report with hashes [$(date)]"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Clean up
run: rm open_issues.json closed_issues.json
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
git pull origin ${{ github.event.inputs.branch }} # Pull the latest changes from the branch
git add . # Add changes before committing
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
git push origin ${{ github.event.inputs.branch }} # Push changes to the specified branch
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\src\\github-update-issues.ts",
"outFiles": [
"${workspaceFolder}/**/*.js"
]
}
]
}
Loading