diff --git a/.github/workflows/publish_documentation.yml b/.github/workflows/publish_documentation.yml index 5c5dd07e19..d113a00a1a 100644 --- a/.github/workflows/publish_documentation.yml +++ b/.github/workflows/publish_documentation.yml @@ -100,18 +100,87 @@ jobs: TSF/scripts/generate_report.sh "https://${OWNER_NAME}.github.io/${REPO_NAME}/main" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + + - name: Install tools + run: | + sudo apt-get update + sudo apt-get install -y jq + sudo apt install gh -y + + - name: Authenticate with GitHub CLI + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token + - name: Checkout data storage branch run: | git stash push --include-untracked -- $(git status --porcelain | awk '{print $2}' | grep -v TSF/TrustableScoring.db) git checkout save_historical_data + git pull + + - name: Fetch open issues labelled as bug from nlohmann/json + id: fetch_issues + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token + + # Define variables + REPO="nlohmann/json" # Target repository + OUTPUT_FILE="TSF/misbehaviours.md" + + # Check if the target repository is reachable + if ! gh repo view "$REPO" --json name -q .name; then + echo "Could not reach the target repository ($REPO). Aborting workflow." + exit 1 + fi + + # Fetch open issues from the nlohmann/json repository + gh issue list --repo "$REPO" --state open --limit 10000 --json number,title,state,createdAt,url,labels > raw_open_issues.json + + # Fetch closed issues from the nlohmann/json repository + gh issue list --repo "$REPO" --state closed --limit 10000 --json number,title,state,createdAt,url,labels > raw_closed_issues.json + + # Add title to the output file + echo "# Misbehaviours Report" > $OUTPUT_FILE + echo "" >> $OUTPUT_FILE + echo "This report lists known misbehaviours or bugs of v3.12.0 of the nlohmann/json repository. The misbehaviours are compiled from github issues of the nlohmann/json repository, and link to each corresponding issue." >> $OUTPUT_FILE + echo "" >> $OUTPUT_FILE + + # Add subtitle for open issues + echo "## Open Issues" >> $OUTPUT_FILE + echo "" >> $OUTPUT_FILE + + # Filter raw open issues for labels containing "bug" and convert to output .md file + jq -r ' + map(select(.labels[]?.name | test("bug"; "i"))) | + map("### [#\(.number)](\(.url))\n- **Title:** \(.title)\n- **State:** \(.state)\n- **Created At:** \(.createdAt)\n") | + .[] + ' raw_open_issues.json >> $OUTPUT_FILE + + # Add subtitle for closed issues + echo "" >> $OUTPUT_FILE + echo "## Closed Issues (since v3.12.0)" >> $OUTPUT_FILE + echo "" >> $OUTPUT_FILE + + # Filter raw closed issues for labels containing "bug", created after release date of nlohmann/json version in use, and convert to output .md file + jq -r ' + map(select(.labels[]?.name | test("bug"; "i"))) | + map(select(.createdAt > "2025-04-11T00:00:00Z")) | # Adjust date as needed, 2025-04-11 corresponds to release v3.12.0 of nlohmann/json + map("### [#\(.number)](\(.url))\n- **Title:** \(.title)\n- **State:** \(.state)\n- **Created At:** \(.createdAt)\n") | + .[] + ' raw_closed_issues.json >> $OUTPUT_FILE + + mkdir -p TSF + + # Push misbehaviours file to save_historical_data branch + git add TSF/misbehaviours.md + git commit -m "Updated issues list" || echo "No changes to commit" + git push origin save_historical_data - name: Store persistent data run: | git add TSF/TrustableScoring.db git commit -m "Append data storage" || echo "Historical data already up to date." git push origin save_historical_data - + - name: Recover stash run: | git checkout $branch_name