mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-08 08:10:30 +00:00
GitHub Enterprise support (#658)
* Add option to specify custom GitHub instance * Use correct GHE API endpoint URLs Co-authored-by: Markus Wolf <[email protected]> * Extract slug from GitHub Enterprise URLs Co-authored-by: Markus Wolf <[email protected]> * Use GITHUB_TOKEN for clone authenticate if provided This change will allow use authentication for cloning actions from private repositories or github enterprise instances. Co-Authored-By: Markus Wolf <[email protected]> * Add section about using act on GitHub Enterprise to README Co-authored-by: Markus Wolf <[email protected]> * Set GitHubInstance in runnerConfig in runner_test Co-authored-by: Markus Wolf <[email protected]> Co-authored-by: hackercat <[email protected]> Co-authored-by: Markus Wolf <[email protected]>
This commit is contained in:
9 files changed
+68
-17
No files matched your search
@@ -503,7 +503,7 @@ func (rc *RunContext) getGithubContext() *githubContext {
|
||||
}
|
||||
|
||||
repoPath := rc.Config.Workdir
|
||||
repo, err := common.FindGithubRepo(repoPath)
|
||||
repo, err := common.FindGithubRepo(repoPath, rc.Config.GitHubInstance)
|
||||
if err != nil {
|
||||
log.Warningf("unable to get git repo: %v", err)
|
||||
} else {
|
||||
@@ -644,6 +644,11 @@ func (rc *RunContext) withGithubEnv(env map[string]string) map[string]string {
|
||||
env["GITHUB_SERVER_URL"] = "https://github.com"
|
||||
env["GITHUB_API_URL"] = "https://api.github.com"
|
||||
env["GITHUB_GRAPHQL_URL"] = "https://api.github.com/graphql"
|
||||
if rc.Config.GitHubInstance != "github.com" {
|
||||
env["GITHUB_SERVER_URL"] = fmt.Sprintf("https://%s", rc.Config.GitHubInstance)
|
||||
env["GITHUB_API_URL"] = fmt.Sprintf("https://%s/api/v3", rc.Config.GitHubInstance)
|
||||
env["GITHUB_GRAPHQL_URL"] = fmt.Sprintf("https://%s/api/graphql", rc.Config.GitHubInstance)
|
||||
}
|
||||
|
||||
job := rc.Run.Job()
|
||||
if job.RunsOn() != nil {
|
||||
|
||||
Reference in new issue
Block a user