Skip to content

Update External Data #7

Update External Data

Update External Data #7

name: Update External Data
on:
schedule:
# Run once a week on Monday at 14:00 UTC (recommended by Flathub)
- cron: '0 14 * * 1'
workflow_dispatch: # Allow manual triggering
inputs:
only_check:
description: 'Only check for updates (do not create PRs)'
required: false
default: false
type: boolean
jobs:
flatpak-external-data-checker:
runs-on: ubuntu-latest
if: github.repository_owner == 'tobagin' # Only run on main repo
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up environment
run: |
# Install dependencies for external data checker
sudo apt-get update
sudo apt-get install -y python3-aiohttp python3-toml python3-ruamel.yaml
- name: Check for updates with External Data Checker
id: check
env:
GIT_AUTHOR_NAME: External Data Checker Bot
GIT_COMMITTER_NAME: External Data Checker Bot
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Use the official External Data Checker Docker image
docker run --rm \
-v "$PWD:/app" \
-w /app \
-e GIT_AUTHOR_NAME \
-e GIT_COMMITTER_NAME \
-e GIT_AUTHOR_EMAIL \
-e GIT_COMMITTER_EMAIL \
-e GITHUB_TOKEN \
ghcr.io/flathub/flatpak-external-data-checker:latest \
--update \
${{ github.event.inputs.only_check == 'true' && '--dry-run' || '--never-fork' }} \
packaging/io.github.tobagin.digger.yml
- name: Create PR if updates found
if: github.event.inputs.only_check != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Check if there are changes to commit
if git diff --quiet; then
echo "ℹ️ No updates found"
echo "updates_found=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "πŸ”„ Updates found, creating PR..."
echo "updates_found=true" >> $GITHUB_OUTPUT
# Get current date for PR naming
CURRENT_DATE=$(date +"%Y-%m-%d")
BRANCH_NAME="external-data-update-$CURRENT_DATE"
# Create new branch
git checkout -b "$BRANCH_NAME"
# Commit changes
git add -A
git commit -m "πŸ“¦ Update external dependencies ($CURRENT_DATE)
Automated update of external data sources:
- Checked for new releases and versions
- Updated manifest with latest available versions
- Verified source URLs and checksums
Generated by: flatpak-external-data-checker
Workflow: .github/workflows/update-external-data.yml"
# Push branch
git push origin "$BRANCH_NAME"
# Create PR
gh auth login --with-token <<< "$GITHUB_TOKEN"
gh pr create \
--title "πŸ”„ External Data Update - $CURRENT_DATE" \
--body "## πŸ€– Automated External Data Update
This PR contains automated updates to external dependencies found by the External Data Checker.
### What's Updated
- βœ… Checked all external data sources in Flatpak manifest
- πŸ“¦ Updated to latest available versions where found
- πŸ” Verified source URLs and integrity hashes
- πŸ“… Generated on: $CURRENT_DATE
### Review Checklist
- [ ] Verify version numbers are correct
- [ ] Check that URLs are accessible
- [ ] Confirm hash/checksum values are accurate
- [ ] Test build works with updated dependencies
### Automation Details
- **Tool:** [flatpak-external-data-checker](https://github.com/flathub-infra/flatpak-external-data-checker)
- **Trigger:** Scheduled weekly (Mondays 14:00 UTC)
- **Workflow:** \`.github/workflows/update-external-data.yml\`
---
πŸ› οΈ **Manual Testing:**
\`\`\`bash
# Test build locally:
flatpak-builder --user --install build packaging/io.github.tobagin.digger.yml
\`\`\`
*πŸ€– This PR was automatically generated by GitHub Actions*" \
--head "$BRANCH_NAME" \
--base "main"
- name: Summary
if: always()
run: |
echo "## πŸ” External Data Checker Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Date:** $(date)" >> $GITHUB_STEP_SUMMARY
echo "**Mode:** ${{ github.event.inputs.only_check == 'true' && 'Check Only (Dry Run)' || 'Check and Update' }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if git diff --quiet; then
echo "ℹ️ **Result:** No updates found" >> $GITHUB_STEP_SUMMARY
echo "All external data sources are up to date" >> $GITHUB_STEP_SUMMARY
else
echo "βœ… **Result:** Updates found and processed" >> $GITHUB_STEP_SUMMARY
if [[ "${{ github.event.inputs.only_check }}" != "true" ]]; then
echo "πŸ“ Pull request created with updates" >> $GITHUB_STEP_SUMMARY
else
echo "πŸ” Dry run completed - no changes committed" >> $GITHUB_STEP_SUMMARY
fi
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Checked Sources:**" >> $GITHUB_STEP_SUMMARY
echo "- Digger repository releases (GitHub API)" >> $GITHUB_STEP_SUMMARY
echo "- LibGee source archives (GNOME)" >> $GITHUB_STEP_SUMMARY
echo "- LibUV source archives" >> $GITHUB_STEP_SUMMARY
echo "- BIND source archives (ISC)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Next Scheduled Run:** $(date -d 'next Monday 14:00' '+%Y-%m-%d %H:%M UTC')" >> $GITHUB_STEP_SUMMARY