Skip to content

Colota - Android GPS Location tracker

Fix dependency updates workflow to only report minor/patch updates

Max Dietrich3018d7caa815
diff --git a/.github/workflows/dependency-updates.yml b/.github/workflows/dependency-updates.yml
index c5391dea..af678218 100644
--- a/.github/workflows/dependency-updates.yml
+++ b/.github/workflows/dependency-updates.yml
@@ -30,7 +30,7 @@ jobs:
- name: Check for updates
run: |
- ncu > updates.txt
+ ncu --deep --target minor > updates.txt
cat updates.txt
- name: Create issue if updates available
@@ -39,65 +39,58 @@ jobs:
script: |
const fs = require('fs');
const updates = fs.readFileSync('updates.txt', 'utf8');
-
- if (updates.includes('β†’')) {
- const issueBody = `## πŸ“¦ Dependency Updates Available
-
- The following packages have updates available:
-
- \`\`\`
- ${updates}
- \`\`\`
-
- ### How to update:
-
- \`\`\`bash
- # Update all packages
- ncu -u
- npm install
-
- # Or update specific packages
- npm update package-name
- \`\`\`
-
- **Note**: Test thoroughly after updating, especially major version changes.
-
- ---
- *Automatically generated by dependency-update workflow*`;
-
- const issues = await github.rest.issues.listForRepo({
+
+ if (!updates.includes('β†’')) {
+ console.log('No updates available');
+ return;
+ }
+
+ const issueBody = `## Dependency Updates Available
+
+ The following minor/patch updates are available:
+
+ \`\`\`
+ ${updates}
+ \`\`\`
+
+ ### How to update:
+
+ \`\`\`bash
+ ncu -u --target minor --deep
+ npm install
+ \`\`\`
+
+ ---
+ *Automatically generated by dependency-update workflow*`;
+
+ const issues = await github.rest.issues.listForRepo({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ state: 'open',
+ labels: 'dependencies'
+ });
+
+ const existingIssue = issues.data.find(issue =>
+ issue.title === 'Dependency Updates Available'
+ );
+
+ if (existingIssue) {
+ await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
- state: 'open',
- labels: 'dependencies'
+ issue_number: existingIssue.number,
+ body: issueBody
});
-
- const existingIssue = issues.data.find(issue =>
- issue.title === 'πŸ“¦ Dependency Updates Available'
- );
-
- if (existingIssue) {
- // Update existing issue
- await github.rest.issues.update({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: existingIssue.number,
- body: issueBody
- });
- console.log('Updated existing issue');
- } else {
- // Create new issue
- await github.rest.issues.create({
- owner: context.repo.owner,
- repo: context.repo.repo,
- title: 'πŸ“¦ Dependency Updates Available',
- body: issueBody,
- labels: ['dependencies', 'maintenance']
- });
- console.log('Created new issue');
- }
+ console.log('Updated existing issue');
} else {
- console.log('No updates available');
+ await github.rest.issues.create({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ title: 'Dependency Updates Available',
+ body: issueBody,
+ labels: ['dependencies', 'maintenance']
+ });
+ console.log('Created new issue');
}
security-audit: