Skip to content

[ca] Fix linting and test failures in CI - #8579

Merged
pelikhan merged 1 commit into
mainfrom
ci-cleaner-fixes-20260102-062432-df21a3d86ac7facf
Jan 2, 2026
Merged

[ca] Fix linting and test failures in CI#8579
pelikhan merged 1 commit into
mainfrom
ci-cleaner-fixes-20260102-062432-df21a3d86ac7facf

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

This PR fixes all CI failures on the main branch discovered by the automated CI cleaner workflow.

Changes Made

1. Linting Fixes

  • testifylint violations in pkg/cli/completions_test.go: Changed assert.Equal(t, len(a), len(b)) to assert.Len(t, b, len(a)) to use the proper testify assertion for length comparisons.

2. Test Fixes

Maintenance Workflow Cron Generation

  • File: pkg/workflow/maintenance_workflow.go
  • Issue: The generateMaintenanceCron function was using hours as input but tests expected days-based scheduling
  • Fix: Updated function to convert hours to days before determining cron schedule frequency, matching test expectations

GitHub Tool Permissions Validation

  • Files: pkg/workflow/strict_mode_test.go, pkg/workflow/workflow_run_validation_test.go
  • Issue: New permission validation logic was triggering warnings about missing GitHub tool permissions in test workflows
  • Fix: Updated test workflows to explicitly disable GitHub tools (github: false) to avoid permission validation warnings when not testing GitHub tool functionality

Add Command Flag Test

  • File: pkg/cli/add_command_test.go
  • Issue: Test expected -c shorthand for --number flag, but this conflicts with logs command's --count flag
  • Fix: Updated test to expect no shorthand for --number flag, aligning with flag consistency rules

Validation

All tests now pass:

  • ✓ Go formatting (go fmt)
  • ✓ JavaScript formatting (prettier)
  • ✓ Linting (golangci-lint)
  • ✓ All unit tests (go test ./...)

Test Results

ok github.com/githubnext/gh-aw/cmd/gh-aw
ok github.com/githubnext/gh-aw/pkg/awmg
ok github.com/githubnext/gh-aw/pkg/campaign
ok github.com/githubnext/gh-aw/pkg/cli
ok github.com/githubnext/gh-aw/pkg/cli/fileutil
ok github.com/githubnext/gh-aw/pkg/console
ok github.com/githubnext/gh-aw/pkg/constants
ok github.com/githubnext/gh-aw/pkg/gitutil
ok github.com/githubnext/gh-aw/pkg/logger
ok github.com/githubnext/gh-aw/pkg/mathutil
ok github.com/githubnext/gh-aw/pkg/parser
ok github.com/githubnext/gh-aw/pkg/repoutil
ok github.com/githubnext/gh-aw/pkg/sliceutil
ok github.com/githubnext/gh-aw/pkg/stringutil
ok github.com/githubnext/gh-aw/pkg/styles
ok github.com/githubnext/gh-aw/pkg/testutil
ok github.com/githubnext/gh-aw/pkg/timeutil
ok github.com/githubnext/gh-aw/pkg/workflow
ok github.com/githubnext/gh-aw/scripts

Context

This PR was generated automatically by the CI cleaner agent (workflow run #334) which runs twice daily to maintain CI health on the main branch.

AI generated by CI Cleaner

- Fix testifylint issues in completions_test.go (use assert.Len instead of assert.Equal for length comparisons)
- Fix maintenance workflow cron schedule generation to use days instead of hours for scheduling logic
- Update workflow tests to disable GitHub tools to avoid permission validation warnings
- Fix add command test to expect no shorthand for --number flag (avoids conflict with logs -c)
@pelikhan
pelikhan marked this pull request as ready for review January 2, 2026 06:43
@pelikhan
pelikhan merged commit 722a478 into mainJan 2, 2026
4 checks passed
@pelikhan
pelikhan deleted the ci-cleaner-fixes-20260102-062432-df21a3d86ac7facf branch January 2, 2026 06:43
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@pelikhan