- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6.2k
Send email on Workflow Run Success/Failure #34982
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            46 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      c8b64c7
              
                Refactor
              
              
                NorthRealm 027c9fe
              
                MAILER
              
              
                NorthRealm 0081ef8
              
                Merge branch 'main' into patch3
              
              
                NorthRealm 31d82a4
              
                Merge branch 'main' into patch4
              
              
                NorthRealm a630935
              
                MAILER
              
              
                NorthRealm 1f6c68d
              
                MAILER
              
              
                NorthRealm bf468fe
              
                MAILER
              
              
                NorthRealm bf3559f
              
                MAILER
              
              
                NorthRealm bb5e10b
              
                fmt
              
              
                NorthRealm ed7b2bc
              
                Refactor
              
              
                NorthRealm 0126656
              
                Merge branch 'patch3' into patch4
              
              
                NorthRealm 4f3f1b9
              
                Decoration
              
              
                NorthRealm a0737b1
              
                Decoration
              
              
                NorthRealm 53970ec
              
                Refactor
              
              
                NorthRealm 8100f63
              
                silly
              
              
                NorthRealm 204f7ca
              
                stop if cannot render template
              
              
                NorthRealm d41aee8
              
                34982#discussion_r2191579495
              
              
                NorthRealm 2bac8d8
              
                terrible
              
              
                NorthRealm afe2dee
              
                Merge branch 'patch3' into patch4
              
              
                NorthRealm cc6c8d1
              
                Any other recipient?
              
              
                NorthRealm 6a28be3
              
                style
              
              
                NorthRealm 9da6b36
              
                Merge branch 'main' into workflow-email
              
              
                wxiaoguang 2fa624a
              
                fix merge
              
              
                wxiaoguang 0a92da5
              
                sort
              
              
                NorthRealm 65b1f08
              
                Merge remote-tracking branch 'upstream/main' into patch4
              
              
                NorthRealm 7a635dd
              
                Merge remote-tracking branch 'upstream/main' into patch4
              
              
                NorthRealm 540c3f0
              
                DATABASE
              
              
                NorthRealm 4f31cd8
              
                UI
              
              
                NorthRealm 32ad9ba
              
                update
              
              
                NorthRealm 07602a0
              
                fix
              
              
                NorthRealm d92ec01
              
                locale
              
              
                NorthRealm fed3ade
              
                rewrite
              
              
                NorthRealm 985e641
              
                update
              
              
                NorthRealm 628ace2
              
                UPDATE
              
              
                NorthRealm 391d6ee
              
                update
              
              
                NorthRealm 741263b
              
                workaround
              
              
                NorthRealm b94baa4
              
                Merge branch 'main' into patch4
              
              
                NorthRealm 33000c7
              
                remove
              
              
                NorthRealm 3ce0d7e
              
                fix
              
              
                wxiaoguang 253c18d
              
                fix
              
              
                wxiaoguang 0ddbbad
              
                update
              
              
                NorthRealm 538e1d7
              
                Merge branch 'main' into patch4
              
              
                NorthRealm 8bca910
              
                Merge branch 'main' into patch4
              
              
                GiteaBot 0962127
              
                Merge branch 'main' into patch4
              
              
                GiteaBot 4864860
              
                Merge branch 'main' into patch4
              
              
                GiteaBot ced3cb5
              
                Merge branch 'main' into patch4
              
              
                GiteaBot File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or 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
    
  
  
    
              
              
  
    
      This file contains hidden or 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
    
  
  
    
              
  
    
      This file contains hidden or 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
    
  
  
    
              
  
    
      This file contains hidden or 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
    
  
  
    
              
  
    
      This file contains hidden or 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
    
  
  
    
              
  
    
      This file contains hidden or 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
    
  
  
    
              
  
    
      This file contains hidden or 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
    
  
  
    
              
  
    
      This file contains hidden or 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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -16,6 +16,7 @@ import ( | |
| "testing" | ||
| texttmpl "text/template" | ||
|  | ||
| actions_model "code.gitea.io/gitea/models/actions" | ||
| activities_model "code.gitea.io/gitea/models/activities" | ||
| "code.gitea.io/gitea/models/db" | ||
| issues_model "code.gitea.io/gitea/models/issues" | ||
|  | @@ -298,13 +299,13 @@ func testComposeIssueCommentMessage(t *testing.T, ctx *mailComment, recipients [ | |
| return msgs[0] | ||
| } | ||
|  | ||
| func TestGenerateAdditionalHeaders(t *testing.T) { | ||
| func TestGenerateAdditionalHeadersForIssue(t *testing.T) { | ||
| doer, _, issue, _ := prepareMailerTest(t) | ||
|  | ||
| comment := &mailComment{Issue: issue, Doer: doer} | ||
| recipient := &user_model.User{Name: "test", Email: "[email protected]"} | ||
|  | ||
| headers := generateAdditionalHeaders(comment, "dummy-reason", recipient) | ||
| headers := generateAdditionalHeadersForIssue(comment, "dummy-reason", recipient) | ||
|  | ||
| expected := map[string]string{ | ||
| "List-ID": "user2/repo1 <repo1.user2.localhost>", | ||
|  | @@ -441,6 +442,16 @@ func TestGenerateMessageIDForRelease(t *testing.T) { | |
| assert.Equal(t, "<owner/repo/releases/1@localhost>", msgID) | ||
| } | ||
|  | ||
| func TestGenerateMessageIDForActionsWorkflowRunStatusEmail(t *testing.T) { | ||
| assert.NoError(t, unittest.PrepareTestDatabase()) | ||
|  | ||
| repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2}) | ||
| run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{ID: 795, RepoID: repo.ID}) | ||
| assert.NoError(t, run.LoadAttributes(db.DefaultContext)) | ||
| msgID := generateMessageIDForActionsWorkflowRunStatusEmail(repo, run) | ||
| assert.Equal(t, "<user2/repo2/actions/runs/191@localhost>", msgID) | ||
| } | ||
|  | ||
| func TestFromDisplayName(t *testing.T) { | ||
| tmpl, err := texttmpl.New("mailFrom").Parse("{{ .DisplayName }}") | ||
| assert.NoError(t, err) | ||
|  | ||
      
      Oops, something went wrong.
        
    
  
  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.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.