185 Commits

Author SHA256 Message Date
18f7ed658a pr: move interfaces and mocks to parent package
Some checks failed
go-generate-check / go-generate-check (pull_request) Failing after 22s
2026-01-10 00:40:45 +01:00
c05fa236d1 pr: Add additional unit tests
- Add a test case specifically verifying that `Gitea.SetLabels`
  is called with `staging/Auto` when a *new* project PR is created
  for submodules.
- Verify `PrjGitDescription` and `SetSubmodulesToMatchPRSet` behave
  correctly when a single `PRSet` contains 5+ different package
  repositories.
2026-01-09 18:56:33 +01:00
c866303696 pr: fix PR lists to check packages not just project PRs
Also,
- Add simple unit tests to verify mapping of `models.StateType`
  to internal event strings.
- Verify it correctly wraps `ProcesPullRequest` and handles panics
  via the deferred recovery block.
- Add tests for scenarios where `GetRecentPullRequests` fails.
- Verify the random sleep interval logic (can be tested by mocking
  `time.Sleep` if refactored, or verifying behavior with interval=0).
2026-01-09 17:48:01 +01:00
e806d6ad0d pr: revive PRProcessor sync tests
- Uncomment and fix the existing tests for `synchronized` actions.
- Ensure it uses the new `PullRequestProcessor` interface and mocked dependencies.
2026-01-09 17:12:14 +01:00
abf8aa58fc pr: test PRProcessor that is triggered by webhook
- PullRequestWebhookEvent: Verified that PR events correctly
  trigger processing with all necessary Gitea and Git mocks.
- IssueCommentWebhookEvent: Verified that issue comment events
  (which Gitea often uses for PR comments) are handled correctly.
- Recursion Limit: Verified that the recursion protection logic
  correctly terminates and cleans up when the limit is reached.
- Invalid Data Format: Verified that non-event data types return
  appropriate errors.
2026-01-09 16:59:29 +01:00
4f132ec154 pr: test verifyRepositoryConfiguration 2026-01-09 16:41:25 +01:00
86a7fd072e pr: add test cases for PRProcessor corner cases
- Add scenarios for closed/merged project PRs that trigger
   submodule checks and downstream PR updates (manual merge vs close).
- Test the "Consistency check" logic where submodules are reset
  if they don't match the PR set.
- Test the "superfluous PR" check (no-op PRs that should be closed).
2026-01-09 16:34:07 +01:00
5f5e7d98b5 pr: add some tests for UpdatePrjGitPR 2026-01-09 13:59:02 +01:00
e8738c9585 pr: add tests for RebaseAndSkipSubmoduleCommits 2026-01-09 13:44:53 +01:00
2f18adaa67 pr: move common test helpers to dedicated area 2026-01-09 12:57:42 +01:00
b7f5c97de1 pr: add error handling unit tests 2026-01-08 22:21:33 +01:00
09001ce01b pr: repo_check unit tests 2026-01-08 21:02:18 +01:00
37c9cc7a57 add PRProcessor tests 2026-01-08 20:57:18 +01:00
362e481a09 pr: fix unit tests 2026-01-08 17:54:00 +01:00
49e32c0ab1 PR: actually subscribe to PRComments
In previous fix attempt, there were changes to process IssueComments
but PRComments are their instance of IssueComments distinct from
IssueComments webhook events

Fixes: a418b48809
2025-12-12 16:41:25 +01:00
19d9fc5f1e pr: request staging only when staging.config is there
If the project git does not have a staging.config, then there is
no reason to request reviews by the staging bot.
2025-12-11 17:01:15 +01:00
ae6b638df6 pr: handle case of … and ... elided title
Also do not change title of PR if not created by bot
2025-12-03 12:41:50 +01:00
5756f7ceea pr: only update PR if elided title not changed
Gitea trims long titles so we need to compare if the trimmed length
is same, not entire string that will always differ.
2025-11-28 12:25:58 +01:00
2be0f808d2 pr: make sure issue list is consistent 2025-11-28 12:08:54 +01:00
86acfa6871 pr: set staging auto label according to config
falls back to staging/Auto if nothing is set
2025-11-20 16:25:06 +01:00
9d6db86318 pr: log case of no config in verification check 2025-11-19 17:10:08 +01:00
e11993c81f pr: do not stop processing if failed on some pacakge during check 2025-11-19 16:36:48 +01:00
4bd259a2a0 pr: ignore pkg PR if not open and no PrjGit PR 2025-11-19 16:35:17 +01:00
3ed5ecc3f0 pr: add staging/Auto on new PRs
also, cache timeline fetches
2025-11-17 11:01:45 +01:00
a418b48809 pr: process PR on comments, not issue changes 2025-10-31 13:07:18 +01:00
Jan Zerebecki
5ce92beb52 Add go generate result 2025-10-24 10:39:34 +02:00
ca7966f3e0 pr: sanity check
make sure that the checked out PR matches what Gitea is sending
us, otherwise pause for a few seconds and retry.
2025-10-11 18:10:15 +02:00
0c47ca4d32 pr: updating PR needs to update the SHA
If we are updating a Project Git PR, we need to save the updated
hash or we may be lookign at pre-update PR for various operations,
including merging.

This mostly only affects project gits in devel projects where
the project git could be updated by direct workflow bot, but then
the project is incorrectly resulting in no package update.
2025-10-11 17:25:48 +02:00
7bad8eb5a9 pr: Add config definitions for permission set 2025-10-09 18:43:56 +02:00
1af2f53755 PR: Fix case where PR repo != target repo
Was using a check that the label has the repo name in it, but
this is not always reliable. So, check repo.ID if it's the same.
2025-10-01 15:33:39 +02:00
a4fb3e6151 PR: Don't clobber other's PrjGit description
If we did not create the PRjGit PR, don't touch the title
and description

Closes: #68
2025-09-02 19:47:47 +02:00
4651440457 Revert "Fixing creation or PR even when we don't want it"
This reverts commit e90ba95869.

We need to assign reviews anyway...
2025-08-29 17:09:08 +02:00
e90ba95869 Fixing creation or PR even when we don't want it 2025-08-29 15:08:05 +02:00
1015e79026 PR: don't try to update PR if PrjGit only being updated 2025-08-29 14:36:20 +02:00
833cb8b430 PR: marshall config before logging it 2025-08-28 18:13:11 +02:00
a882ae283f PR: workaround lfs errors
in case where files are not in lfs but should be, the checkout
causes files to be modified. Then the checkout of the PR.Head fails.
There should be better way of dealing with this
2025-08-28 16:30:04 +02:00
72b979b587 PR: remove closed package PRs from a PRset
This used to happen as a side-effect of a different code path
that was removed in b96b784b38
2025-08-27 14:57:43 +02:00
62658e23a7 PR: quiet submodule deinit output 2025-08-27 14:49:16 +02:00
46a187a60e pr: error format fix 2025-08-26 23:50:48 +02:00
f013180c4b PR: assign reviewers only when not merging 2025-08-26 22:41:37 +02:00
b96b784b38 PR: remove broken code 2025-08-26 19:57:48 +02:00
8d0047649a PR: if we have unpushed commits, update PRset
PRset is used elsewhere and if the pending, unpushed commits
are not part of it, we have an old state
2025-08-26 18:59:38 +02:00
2f180c264e PR: check pending changes, pushed changes 2025-08-26 18:16:42 +02:00
7d2233dd4a PR: add NoProjectGitPR option 2025-08-26 16:19:56 +02:00
c30ae5750b PR: clone fixes 2025-08-26 15:47:58 +02:00
ea2134c6e9 PR: checkout a commit, for safety - we can't push to non-branch 2025-08-26 13:51:09 +02:00
b22f418595 PR: process with ProjectGit originating from non-local 2025-08-26 13:37:11 +02:00
c4c9a16e7f PR: fix PR parsing with ! 2025-08-26 12:50:21 +02:00
e96f4d343b PR: catch panic in PR processing 2025-08-26 11:36:28 +02:00
7e055c3169 Merge branch 'jzerebecki-fix-pr-link' 2025-08-25 19:12:59 +02:00