Skip to content

Commit

Permalink
Merge pull request #41 from 5152Alotobots/depchecker
Browse files Browse the repository at this point in the history
fix workflow
  • Loading branch information
SeanErn authored Dec 23, 2024
2 parents 92b0cf7 + de8dd17 commit 712c0c3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
6 changes: 4 additions & 2 deletions .github/scripts/check_vendordeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,14 @@ def main():
if os.getenv('GITHUB_OUTPUT'):
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write(f"has_updates=true\n")
f.write(f"updates={json.dumps(updates)}\n")
# Properly escape the JSON string for GitHub Actions
updates_json = json.dumps(updates).replace('%', '%25').replace('\n', '%0A').replace('\r', '%0D')
f.write(f"updates={updates_json}\n")
else:
print("\nAll dependencies are up to date!")
if os.getenv('GITHUB_OUTPUT'):
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write("has_updates=false\n")

f.write("updates=[]\n")
if __name__ == "__main__":
main()
54 changes: 37 additions & 17 deletions .github/workflows/check_vendordeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,41 @@ jobs:
uses: actions/github-script@v6
with:
script: |
const updates = JSON.parse(process.env.UPDATES);
const body = updates.map(u =>
`### ${u.name}\n` +
`- Current version: ${u.current}\n` +
`- Latest version: ${u.latest}\n` +
`- Source: ${u.source}\n` +
(u.url ? `- [View Release](${u.url})\n` : '') +
(u.name === 'WPILib' ? '\n⚠️ **Note**: Please use WPILib VS Code tools for actual updates\n' : '') +
(u.notes ? '\n<details><summary>Release Notes</summary>\n\n' + u.notes + '\n</details>\n' : '')
).join('\n');
try {
const updates = JSON.parse('${{ steps.check.outputs.updates }}');
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: '🔄 Dependency Updates Available',
body: body,
labels: ['dependencies']
});
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);
}

0 comments on commit 712c0c3

Please sign in to comment.