Skip to content

Commit

Permalink
Update signed-off-by instructions
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Oct 22, 2021
1 parent ede7834 commit b2c183a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 11 deletions.
13 changes: 6 additions & 7 deletions derek.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@ provider:
gateway: http://127.0.0.1:8080

functions:
derek-0913:
derek-0110:
handler: ./
image: alexellis/derek:0.9.13
image: ghcr.io/alexellis/derek:0.11.0
lang: dockerfile
environment:
debug: true
customers_url: https://raw.githubusercontent.com/alexellis/derek/master/.CUSTOMERS
validate_hmac: true
validate_customers: false
validate_customers: true
secret_path: /var/openfaas/secrets/ # use /run/secrets/ for older OpenFaaS versions
write_debug: true
read_timeout: 10s
write_timeout: 10s
combine_output: false
read_timeout: 15s
write_timeout: 15s
combine_output: true
environment_file:
- secrets.yml
# See secrets.example.yml
secrets:
- derek-secret-key
- derek-private-key

5 changes: 5 additions & 0 deletions handler/comment_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package handler

import (
"log"
"os"
"strings"
"testing"
Expand All @@ -12,6 +13,10 @@ import (
"github.com/google/go-github/github"
)

func Test_fixCommitsMessage(t *testing.T) {
log.Println(fixCommits)
}

func Test_getCommandTrigger(t *testing.T) {

triggers := getCommandTriggers()
Expand Down
33 changes: 30 additions & 3 deletions handler/pullrequest_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,39 @@ func VerifyPullRequestDescription(req types.PullRequestOuter, contributingURL st
}
}

const fixCommits = `### :bulb: Shall we fix this?
This will only take a few moments.
First, clone your fork and checkout this branch using the git CLI.
Next, set up your real name and email address:
` + "`" + `git config --global user.name "Your Full Name"` + "`" + `
` + "`" + `git config --global user.email "[email protected]"` + "`" + `
Finally, run one of these commands to add the "Signed-off-by" line to your commits.
If you only have one commit so far then run: ` + "`" + `git commit --amend --signoff` + "`" + ` and then ` + "`" + `git push --force` + "`." + `
If you have multiple commits, watch [this video](https://www.youtube.com/watch?v=8j0H6urZ-bU).
Check that the message has been added properly by running "git log".
`

func anonymousCommitComment(contributingURL string) string {
return `Thank you for your contribution. It seems that one or more of your commits have an anonymous email address. Please consider signing your commits with a valid email address. Please see our [contributing guide](` + contributingURL + `).`
return `Thank you for your contribution. It seems that one or more of your commits have a "Signed-off-by" statement with an anonymous email address. The [Developer Certificate of Origin (DCO)](https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin) requires all commits to be signed off by genuine, contactable individuals. Please see our [contributing guide](` + contributingURL + `).
` + fixCommits
}

func unsignedCommitComment(contributingURL string) string {
return `Thank you for your contribution. I've just checked and your commit doesn't appear to be signed-off. That's something we need before your Pull Request can be merged. Please see our [contributing guide](` + contributingURL + `).
Tip: if you only have one commit so far then run: ` + "`" + `git commit --amend --signoff` + "`" + ` and then ` + "`" + `git push --force` + "`."

return `Thank you for your contribution. unfortunately, one or more of your commits are missing the required "Signed-off-by:" statement. Signing off is part of the [Developer Certificate of Origin (DCO)](https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin) which is used by this project.
Read the DCO and [project contributing guide](` + contributingURL + `) carefully, and amend your commits using the git CLI. Note that this does not require any cryptography, keys or special steps to be taken.
` + fixCommits

}

func emptyDescriptionComment(contributingURL string) string {
Expand Down Expand Up @@ -442,6 +468,7 @@ func updateUnsuccessfulDCOCheck(checks *github.ListCheckRunsResults) github.Upda
now := github.Timestamp{time.Now()}
text := `Thank you for your contribution. I've just checked and your commit doesn't appear to be signed-off.
That's something we need before your Pull Request can be merged.`

title := "Unsigned commits"
summary := "One or more of the commits in this Pull Request are not signed-off."

Expand Down
1 change: 0 additions & 1 deletion secrets.example.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
environment:
secret_key: com.openfaas.www
application_id: 1234

0 comments on commit b2c183a

Please sign in to comment.