Skip to content
Merged
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
6 changes: 3 additions & 3 deletions lib/plugins/archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = class Archive {
})
return data
} catch (error) {
if (error.status === 404 && !this.getDesiredArchiveState()) {
if (error.status === 404) {
return null
Copy link
Preview

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the !this.getDesiredArchiveState() condition changes the behavior for 404 errors. This now returns null for all 404 errors regardless of the desired archive state, which may not be the intended behavior. Consider documenting why this condition was removed or verify this change doesn't break existing functionality.

Suggested change
return null
if (!this.getDesiredArchiveState()) {
return null
}

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the repo is not existing, whether to archive or unArchive doesn't make much of a difference. We cannot throw an Error and stop further processing.

}
throw error
Expand Down Expand Up @@ -59,13 +59,13 @@ module.exports = class Archive {
shouldArchive (repository = this.repository) {
const desiredState = this.getDesiredArchiveState()
if (desiredState === null) return false
return !repository.archived && desiredState
return !repository?.archived && desiredState
}

shouldUnarchive (repository = this.repository) {
const desiredState = this.getDesiredArchiveState()
if (desiredState === null) return false
return repository.archived && !desiredState
return repository?.archived && !desiredState
}

isArchived () {
Expand Down