forgejo_backup/services/actions
Earl Warren b2c4fc9f94 bug: Forgejo Actions email notifications are opt-in (#8242)
* Add the `notify-email` column / NotifyEmail to ActionRun and set it:
  * services/actions/workflows.go `Dispatch`
  * services/actions/schedule_tasks.go `CreateScheduleTask`
  * services/actions/notifier_helper.go `handleWorkflows`
* Only send an email if the workflow has `enable-email-notifications: true` by having `MailActionRun` return immediately if `NotifyEmail` is false.
* Ignore or silently fail on `enable-email-notifications: true` parsing errors. Reporting such errors  belongs in workflow validation, not when it is evaluated for the notifications.
* Add unit and integration tests.

Refs: https://codeberg.org/forgejo/forgejo/issues/8187

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.

### Documentation

- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] I do not want this change to show in the release notes.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8242
Reviewed-by: Christopher Besch <mail@chris-besch.com>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-06-21 13:11:01 +02:00
..
auth.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
auth_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
cleanup.go feat: auto cleanup of offline runners (#7803) 2025-06-08 00:13:37 +02:00
cleanup_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
clear_tasks.go Actions Done Notification (#7491) 2025-04-24 15:15:24 +00:00
commit_status.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
context.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
context_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
init.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
interface.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
job_emitter.go Actions Done Notification (#7491) 2025-04-24 15:15:24 +00:00
job_emitter_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
main_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
notifier.go better comments and variable names for ActionRunNowDone (#7697) 2025-04-28 06:37:08 +00:00
notifier_helper.go bug: Forgejo Actions email notifications are opt-in (#8242) 2025-06-21 13:11:01 +02:00
notifier_helper_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
rerun.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
rerun_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
schedule_tasks.go bug: Forgejo Actions email notifications are opt-in (#8242) 2025-06-21 13:11:01 +02:00
schedule_tasks_test.go bug: Forgejo Actions email notifications are opt-in (#8242) 2025-06-21 13:11:01 +02:00
task.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
variables.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
workflows.go bug: Forgejo Actions email notifications are opt-in (#8242) 2025-06-21 13:11:01 +02:00