Skip to content

Detect whether action view branch was deleted - #32764

Merged
lunny merged 15 commits into
go-gitea:mainfrom
lunny:lunny/detect_action_branch_deleted
Dec 12, 2024
Merged

lunny merged 15 commits into
go-gitea:mainfrom
lunny:lunny/detect_action_branch_deleted

Conversation

@lunny

@lunny lunny commented Dec 8, 2024

Copy link
Copy Markdown
Member

Fix #32761

图片

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 8, 2024
@lunny lunny added this to the 1.23.0 milestone Dec 8, 2024
Comment thread routers/web/repo/actions/view.go Outdated
@yp05327

yp05327 commented Dec 9, 2024 •

Copy link
Copy Markdown
Contributor

Not do it in RefLink()?

In runs_list.tmpl, it is also used. So I guess in runs list page, you will get similar issue.
image

@lunny

lunny commented Dec 10, 2024

Copy link
Copy Markdown
Member Author

Not do it in RefLink()?

In runs_list.tmpl, it is also used. So I guess in runs list page, you will get similar issue. image

Done in 890863f

@lunny
lunny requested a review from yp05327 December 10, 2024 05:41
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Dec 10, 2024
Comment thread routers/web/repo/actions/actions.go Outdated
Comment thread models/git/branch.go Outdated
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Dec 11, 2024
Comment thread web_src/js/components/RepoActionView.vue Outdated
Comment thread templates/repo/actions/runs_list.tmpl Outdated
Comment thread routers/web/repo/actions/actions.go Outdated
if refName.IsBranch() {
branchName := refName.ShortName()
run.IsRefDeleted = true // assume it's deleted then if it's found in the database it's not deleted
branchRuns[branchName] = append(branchRuns[branchName], run)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it right? What if a branch starts 2 runs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And since the logic seems fragile, I think it needs tests

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Is it right? What if a branch starts 2 runs?

A branch could start multiple runs, feature branches maybe updated multiple times and main branches may merge many commits. All these behaviours will trigger action runs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

de6160a

Comment thread routers/web/repo/actions/actions.go
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Dec 12, 2024
@lunny
lunny enabled auto-merge (squash) December 12, 2024 18:51
@lunny
lunny merged commit 6370d2f into go-gitea:main Dec 12, 2024
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Dec 12, 2024
@lunny
lunny deleted the lunny/detect_action_branch_deleted branch December 12, 2024 19:29
zjjhot added a commit to zjjhot/gitea that referenced this pull request Dec 13, 2024
* giteaofficial/main:
  Fix bug of branch/tag selector in the issue sidebar (go-gitea#32744)
  Fix lfs migration (go-gitea#32812)
  Avoid MacOS keychain dialog in integration tests (go-gitea#32813)
  Update actionlint.yaml
  Detect whether action view branch was deleted (go-gitea#32764)
  Add "n commits" link to contributors in contributors graph page (go-gitea#32799)
  Fix "unicode escape" JS error (go-gitea#32806)
  use dedicated runners for release artifacts (go-gitea#32811)
  Make API "compare" accept commit IDs (go-gitea#32801)
  Implement update branch API (go-gitea#32433)
  Fix JS error when dropping a file to a editor without dropzone (go-gitea#32804)
  chore: use errors.New to replace fmt.Errorf with no parameters (go-gitea#32800)
@lunny lunny added the type/enhancement An improvement of existing functionality label Dec 16, 2024
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Mar 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Action view branch button doesn't check for deleted branch

7 participants