Check Dependencies #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Dependencies | |
on: | |
schedule: | |
- cron: '0 12 */2 * *' # Run at noon UTC every other day | |
workflow_dispatch: # Allow manual triggers | |
jobs: | |
check-updates: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: pip install requests packaging | |
- name: Check for updates | |
id: check | |
run: python .github/scripts/check_vendordeps.py | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Issue for Updates | |
if: steps.check.outputs.has_updates == 'true' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
try { | |
const updates = JSON.parse('${{ steps.check.outputs.updates }}'); | |
let body = '# Dependency Updates Available\n\n'; | |
for (const update of updates) { | |
body += `### ${update.name}\n`; | |
body += `- Current version: ${update.current}\n`; | |
body += `- Latest version: ${update.latest}\n`; | |
body += `- Source: ${update.source}\n`; | |
if (update.url) { | |
body += `- [View Release](${update.url})\n`; | |
} | |
if (update.name === 'WPILib') { | |
body += '\n⚠️ **Note**: Please use WPILib VS Code tools for actual updates\n'; | |
if (update.notes) { | |
body += '\n<details><summary>Release Notes</summary>\n\n'; | |
body += update.notes; | |
body += '\n</details>\n'; | |
} | |
} | |
body += '\n'; | |
} | |
await github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: '🔄 Dependency Updates Available', | |
body: body, | |
labels: ['dependencies'] | |
}); | |
} catch (error) { | |
console.error('Error processing updates:', error); | |
core.setFailed(error.message); | |
} |