-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(actions): support cron schedule task #26655
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Bo-Yi.Wu <[email protected]>
Signed-off-by: Bo-Yi.Wu <[email protected]>
Signed-off-by: Bo-Yi.Wu <[email protected]>
- Remove `robfig/cron/v3 v3.0.1` from `go.mod` - Remove `newSchedule()` and `resetSchedule()` functions from `services/actions/init.go` - Change return type of `CreateScheduleTask()` from `(int, error)` to `error` in `services/actions/notifier_helper.go` - Add `services/actions/schedule_tasks.go` file - Add `StartScheduleTasks()` and `startTasks()` functions to `services/actions/schedule_tasks.go` - Register `start_schedule_tasks` task in `services/cron/tasks_actions.go` Signed-off-by: Bo-Yi Wu <[email protected]>
- Add a new function `GetSchedulesMapByIDs` to retrieve schedules by ID - Create new schedule and schedule spec when creating a schedule task - Delete schedule specs when deleting a schedule - Add a new model `ActionScheduleSpec` for schedule specs Signed-off-by: Bo-Yi Wu <[email protected]>
- Rename v245.go to v246.go - Add a new migration for action schedule table addition Signed-off-by: Bo-Yi Wu <[email protected]>
- Rename the `Webhook org_id` column to `owner_id` - Add a new migration for creating an `action schedule` table
…nability - Rename `jobs` to `workflows` in `notifier_helper.go` - Fix the `if` statement to properly continue in `notifier_helper.go` - Remove unnecessary `else` block in `notifier_helper.go` Signed-off-by: Bo-Yi.Wu <[email protected]>
…on v246 - Remove `EntryIDs` field from `ActionSchedule` struct in `schedule.go` - Remove `EntryIDs` field from migration v246 in `v1_20` folder Signed-off-by: Bo-Yi.Wu <[email protected]>
- Rename `jobs` to `workflows` for clarity - Simplify error handling in line 14 - Simplify error handling in line 19 - Remove unnecessary else statement in line 22 Signed-off-by: Bo-Yi.Wu <[email protected]>
- Remove the license for `github.com/robfig/cron/v3` Signed-off-by: Bo-Yi.Wu <[email protected]>
- Update `CreateScheduleTask` to use the passed context instead of `db.DefaultContext` - Update `DeleteScheduleTaskByRepo` to use the passed context instead of `db.DefaultContext` Signed-off-by: Bo-Yi.Wu <[email protected]>
- Delete the `ifNeedApproval` function from `notifier_helper.go` Signed-off-by: Bo-Yi.Wu <[email protected]>
- Add a license to the `go-licenses.json` file Signed-off-by: Bo-Yi.Wu <[email protected]>
- Remove a line that had no newline at the end of the file Signed-off-by: Bo-Yi.Wu <[email protected]>
- Add an import statement in `schedule_spec_list.go` Signed-off-by: Bo-Yi.Wu <[email protected]>
- Change `run` initialization to a pointer - Add function `ifNeedApproval` for deciding if a user needs approval - Modify `handleWorkflows` to use `ifNeedApproval` function - Add `NeedApproval` field to `run` in `handleWorkflows` function Signed-off-by: Bo-Yi.Wu <[email protected]>
- Fix a typo in the `CreateScheduleTask` function - Remove unnecessary code from the `CreateScheduleTask` function Signed-off-by: Bo-Yi.Wu <[email protected]>
- Add `xorm: "index"` tag to `RepoID` and `ScheduleID` fields in `ActionScheduleSpec` - Remove `RepoID` and `ScheduleID` fields from the model struct Signed-off-by: Bo-Yi.Wu <[email protected]>
- Remove the function `CreateScheduleTask` from the `notifier_helper.go` file - Add the function `CreateScheduleTask` to the `schedule_tasks.go` file, which creates a scheduled task from a cron action schedule and a spec string. It creates an action run based on the schedule, inserts it into the database, and creates commit statuses for each job. Signed-off-by: Bo-Yi.Wu <[email protected]>
- Change in variable assignment for `specs` in `startTasks` function Signed-off-by: Bo-Yi.Wu <[email protected]>
- Remove the handleWorkflows function and replace it with a new version that has a different signature and takes more arguments. Signed-off-by: Bo-Yi.Wu <[email protected]>
Co-authored-by: Jason Song <[email protected]>
- Update the `now` variable to truncate to the nearest minute - Change the calculation of `next` to use `now.Add(-1)` instead of `now` - Replace `next.Sub(now) <= 60` with `schedule.Next(now.Add(-1)).Equal(now)` Signed-off-by: Bo-Yi.Wu <[email protected]>
- Change the initialization of `crons` to allocate capacity upfront, improving performance. - Remove an unused variable definition. - Add a new function `startTasks` with `opts` parameter. Signed-off-by: Bo-Yi.Wu <[email protected]>
silverwind
approved these changes
Aug 22, 2023
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
Aug 22, 2023
wxiaoguang
approved these changes
Aug 23, 2023
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
Aug 23, 2023
wxiaoguang
reviewed
Aug 23, 2023
Co-authored-by: wxiaoguang <[email protected]>
lunny
added
the
reviewed/wait-merge
This pull request is part of the merge queue. It will be merged soon.
label
Aug 23, 2023
GiteaBot
removed
the
reviewed/wait-merge
This pull request is part of the merge queue. It will be merged soon.
label
Aug 24, 2023
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Aug 25, 2023
* giteaofficial/main: Fix review bar misalignment (go-gitea#26711) Use "small-loading-icon" insead of "btn-octicon is-loading" (go-gitea#26710) Improve Image Diff UI (go-gitea#26696) Make issue template field template access correct template data (go-gitea#26698) add Upload URL to release API (go-gitea#26663) Add merge files files to GetCommitFileStatus (go-gitea#20515) PATCH branch-protection updates check list even when checks are disabled (go-gitea#26351) Add `member`, `collaborator`, `contributor`, and `first-time contributor` roles and tooltips (go-gitea#26658) chore(actions): support cron schedule task (go-gitea#26655)
This was referenced Oct 30, 2023
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.
size/XL
Denotes a PR that changes 500-999 lines, ignoring generated files.
topic/gitea-actions
related to the actions of Gitea
type/feature
Completely new functionality. Can only be merged if feature freeze is not active.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replace #22751
@yearly
,@monthly
,@weekly
,@daily
,@hourly
How to use
See the GitHub Actions document for getting more detailed information.
Signed-off-by: Bo-Yi.Wu [email protected]