Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
101 changes: 101 additions & 0 deletions .github/workflows/publish-reports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Publish Reports

on:
push:
pull_request:
workflow_dispatch:
schedule:
# Run every hour (scheduled workflows only run on the default branch, currently 'main')
- cron: '0 * * * *'

jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
pages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'

- name: Install asciidoctor
run: gem install asciidoctor

- name: Install GitHub CLI
run: |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh -y

- name: Generate reports
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x scripts/generate_report.sh
scripts/generate_report.sh

- name: Set Netlify alias
if: github.ref != 'refs/heads/main'
id: netlify-alias
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "alias=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
else
# Use branch name, sanitize it for Netlify (replace / with -)
BRANCH_NAME="${{ github.ref_name }}"
SANITIZED_BRANCH=$(echo "$BRANCH_NAME" | sed 's/\//-/g')
echo "alias=$SANITIZED_BRANCH" >> $GITHUB_OUTPUT
fi

- name: Deploy to Netlify (branches and PRs)
if: github.ref != 'refs/heads/main'
id: netlify-deploy
uses: nwtgck/actions-netlify@v2
with:
publish-dir: './public'
production-deploy: false
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions - ${{ github.event.head_commit.message || github.event.pull_request.title }}"
enable-pull-request-comment: true
enable-commit-comment: false
alias: ${{ steps.netlify-alias.outputs.alias }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

- name: Display Netlify URL
if: github.ref != 'refs/heads/main'
run: |
echo "### 🚀 Netlify Deployment" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ **Deployed successfully!**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔗 **URL:** ${{ steps.netlify-deploy.outputs.deploy-url }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📝 **Alias:** \`${{ steps.netlify-alias.outputs.alias }}\`" >> $GITHUB_STEP_SUMMARY

- name: Upload GitHub Pages artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: ./public

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: actions/deploy-pages@v4
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
tmp/
public/*.adoc
public/*.html
public/*.csv
23 changes: 23 additions & 0 deletions public/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Copyright 2025 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

= Maven Reports

This site contains reports about Apache Maven repositories.

== Available Reports

* xref:dependabot-prs.adoc[Dependabot Pull Requests] - All open Dependabot PRs across Maven repositories
8 changes: 5 additions & 3 deletions scripts/export_maven_prs.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def export_to_csv(prs, filename='/tmp/maven_open_prs.csv'):

return filename

def export_to_asciidoc(prs, filename='/tmp/maven_open_prs.adoc'):
def export_to_asciidoc(prs, filename='/tmp/maven_open_prs.adoc', title='Open Maven PRs'):
"""Export PRs to AsciiDoc file"""
# Group PRs by repository
repos = {}
Expand All @@ -268,7 +268,7 @@ def export_to_asciidoc(prs, filename='/tmp/maven_open_prs.adoc'):
with open(filename, 'w', encoding='utf-8') as f:
# Write header
now = datetime.now().strftime('%a %b %d %H:%M:%S %Z %Y')
f.write('= Open Maven PRs\n\n')
f.write(f'= {title}\n\n')
f.write(f'The following Apache Maven projects have open Pull-Requests as of {now}.\n\n')
f.write('[cols="8,3,2,1", options="header"]\n')
f.write('|===\n')
Expand Down Expand Up @@ -417,7 +417,9 @@ def filter_and_cleanup_archived(repos):

# Export in requested format
if args.format == 'asciidoc':
filename = export_to_asciidoc(prs, output_file)
# Set title based on filter
title = 'Open Maven Dependabot PRs' if args.dependabot else 'Open Maven PRs'
filename = export_to_asciidoc(prs, output_file, title=title)
print(f"Exported AsciiDoc to: {filename}\n", file=sys.stderr)
else:
filename = export_to_csv(prs, output_file)
Expand Down
44 changes: 44 additions & 0 deletions scripts/generate_report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
#
# Copyright 2025 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -e

# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"

# Create public directory if it doesn't exist
mkdir -p "${REPO_ROOT}/public"

# Run the export script
echo "Generating Dependabot PR report..."
"${SCRIPT_DIR}/export_maven_prs.py" \
--format asciidoc \
--dependabot \
--output "${REPO_ROOT}/public/dependabot-prs.adoc"

# Convert all AsciiDoc files to HTML
echo "Converting AsciiDoc files to HTML..."
for adoc_file in "${REPO_ROOT}/public"/*.adoc; do
if [ -f "$adoc_file" ]; then
html_file="${adoc_file%.adoc}.html"
echo " Converting $(basename "$adoc_file")..."
asciidoctor -o "$html_file" "$adoc_file"
fi
done

echo "Report generated successfully in ${REPO_ROOT}/public/"