You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
855 B

  1. // Copyright 2018 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package private
  5. import (
  6. "fmt"
  7. "code.gitea.io/gitea/modules/log"
  8. "code.gitea.io/gitea/modules/setting"
  9. )
  10. // InitWiki initwiki via repo id
  11. func InitWiki(repoID int64) error {
  12. // Ask for running deliver hook and test pull request tasks.
  13. reqURL := setting.LocalURL + fmt.Sprintf("api/internal/repositories/%d/wiki/init", repoID)
  14. log.GitLogger.Trace("InitWiki: %s", reqURL)
  15. resp, err := newInternalRequest(reqURL, "GET").Response()
  16. if err != nil {
  17. return err
  18. }
  19. defer resp.Body.Close()
  20. // All 2XX status codes are accepted and others will return an error
  21. if resp.StatusCode/100 != 2 {
  22. return fmt.Errorf("Failed to init wiki: %s", decodeJSONError(resp).Err)
  23. }
  24. return nil
  25. }