Skip to content

Enable AL-Go for GitHub on GitHub Enterprise Cloud with data residency - #2309

Closed
Freddy Kristiansen (freddydk) wants to merge 39 commits into
microsoft:mainfrom
Freddy-DK:main
Closed

Freddy Kristiansen (freddydk) wants to merge 39 commits into
microsoft:mainfrom
Freddy-DK:main

Conversation

@freddydk

@freddydk Freddy Kristiansen (freddydk) commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

❔What, Why & How

This pull request introduces comprehensive updates to improve compatibility with GitHub Enterprise (GHE) hosts. The main focus is to ensure that all scripts and workflows dynamically use the correct GitHub server and API URLs, rather than hardcoding references to github.com and api.github.com. This enables repositories using AL-Go for GitHub to work seamlessly on both public GitHub and GHE instances. Additionally, documentation has been updated to clarify support and provide guidance for GHE users.

GitHub Enterprise compatibility and dynamic host resolution:

  • All PowerShell scripts and workflow files now use the GITHUB_SERVER_URL and GITHUB_API_URL environment variables instead of hardcoded github.com and api.github.com URLs for REST API calls and repository links. This affects actions such as dependency probing, deployments, pull request validation, and workflow post-processing. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • The workflow now explicitly verifies that the AL-Go for GitHub repository itself only runs on github.com, preventing unsupported usage on GHE for the main repo.
  • The gh CLI commands set the GH_HOST environment variable to ensure API calls target the correct host on GHE. [1] [2] [3]

Documentation and user guidance:

  • Added a new scenario guide, Scenarios/UsingGitHubEnterprise.md, detailing how to use AL-Go for GitHub on GHE, including setup instructions and best practices.
  • The README.md is updated to reference the new GHE usage guide.
  • Release notes summarize the GHE compatibility improvements and clarify the support policy.

Other improvements and fixes:

  • Improved template repository download logic to construct API URLs correctly for both public GitHub and GHE, and to use authenticated or anonymous requests as appropriate. [1] [2] [3]
  • Minor comments and clarifications added to template scripts regarding authentication requirements.

These changes ensure that AL-Go for GitHub works reliably in both public and enterprise GitHub environments, with clear documentation and robust host detection.

This functionality was sponsored by Fellowmind, Sweden.

@freddydk

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

Comment thread Scenarios/UsingGitHubEnterprise.md Outdated
Copilot AI review requested due to automatic review settings July 27, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables AL-Go templates and actions to operate on GitHub Enterprise Cloud data-residency hosts.

Changes:

  • Replaces hardcoded GitHub URLs with runtime server/API URLs.
  • Updates release uploads, dependency retrieval, and template downloads for enterprise hosts.
  • Adds enterprise documentation, release notes, safeguards, and regression fixes.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
Tests/DownloadProjectDependencies.Test.ps1 Tests URL secrets.
Tests/Deploy.Module.Test.ps1 Configures API URL in tests.
Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml Makes release operations host-aware.
Templates/Per Tenant Extension/.AL-Go/localDevEnv.ps1 Clarifies GitHub CLI authentication.
Templates/AppSource App/.github/workflows/CreateRelease.yaml Makes release operations host-aware.
Templates/AppSource App/.AL-Go/localDevEnv.ps1 Clarifies GitHub CLI authentication.
Scenarios/UsingGitHubEnterprise.md Adds enterprise setup guidance.
RELEASENOTES.md Announces enterprise compatibility.
README.md Links the enterprise guide.
Actions/WorkflowPostProcess/WorkflowPostProcess.ps1 Targets the active GitHub CLI host.
Actions/VerifyPRChanges/VerifyPRChanges.ps1 Uses the runtime API URL.
Actions/PullRequestStatusCheck/PullRequestStatusCheck.ps1 Targets the runtime GitHub host.
Actions/Github-Helper.psm1 Derives dependency API hosts.
Actions/GetArtifactsForDeployment/GetArtifactsForDeployment.psm1 Uses host-aware API and run URLs.
Actions/GetArtifactsForDeployment/GetArtifactsForDeployment.ps1 Produces host-aware links.
Actions/DownloadProjectDependencies/DownloadProjectDependencies.psm1 Resolves whole-URL secrets.
Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.psm1 Initializes empty project metadata.
Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.Action.ps1 Emits host-aware build links.
Actions/Deploy/Deploy.psm1 Uses the runtime API URL.
Actions/Deliver/Deliver.ps1 Handles package lookup failures.
Actions/CheckForUpdates/CheckForUpdates.ps1 Configures the GitHub CLI host.
Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 Adds host-aware template downloads.
Actions/AL-Go-Helper.ps1 Updates defaults and dependency URLs.
.github/workflows/CI.yaml Restricts AL-Go development CI to GitHub.com.

Comment thread Actions/Github-Helper.psm1 Outdated
Comment thread Actions/Github-Helper.psm1 Outdated
Comment thread Scenarios/UsingGitHubEnterprise.md
Comment thread Scenarios/UsingGitHubEnterprise.md Outdated
Comment thread Scenarios/UsingGitHubEnterprise.md Outdated
Comment thread Actions/AL-Go-Helper.ps1 Outdated
Comment thread Actions/Deliver/Deliver.ps1 Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 29, 2026 05:53

@NSilvergrund NSilvergrund left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working as expected.

@ajkauffmann

Copy link
Copy Markdown

We are waiting for this! Having data residency for our codebase is paramount for us and our customers, so we need GitHub Enterprise. Without proper support from AL-Go, we can't move to GHE.

@jimmymcp

Copy link
Copy Markdown

We've been running AL-Go on GHE with these changes for a couple of months. Would love to see this officially adopted.

@FBakkensen

Copy link
Copy Markdown

We are really waiting for this, using ghe is non-negotiable for us, and having to rely on a fork is far from ideal.

Comment thread Actions/AL-Go-Helper.ps1 Outdated
Comment thread Actions/AL-Go-Helper.ps1 Outdated
Comment thread Actions/AL-Go-Helper.ps1 Outdated
Comment thread Actions/Github-Helper.psm1
Comment thread Tests/DownloadProjectDependencies.Test.ps1

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Cross-host credentials, local dependency URLs, and the GHE action bootstrap path remain incomplete.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 3 Medium severity · 1 Low severity

Open (4)
Resolved since last review (1)

Comment thread Actions/AL-Go-Helper.ps1 Outdated
Comment thread Actions/Github-Helper.psm1
Comment thread Scenarios/UsingGitHubEnterprise.md
@mazhelez

Copy link
Copy Markdown
Collaborator

Freddy Kristiansen (@freddydk) Thank you for your contribution!

We are excited for AL-Go to support GHE. However, we are currently unable to test your solution properly and, while we figure out the setup, the feature has to marked as "preview" or "experimental".

@freddydk

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

Maria Zhelezova (mazhelez) pushed a commit that referenced this pull request Oct 6, 2026
### ❔What, Why & How

Fixes #2389 

URLs in localdevenv and the settings schema are wrong when running a
self-hosted AL-Go from a fork.

This fix is also included in PR #2309 (this is where the problem occured
for partners using my fork)

---------

Co-authored-by: Freddy Kristiansen <fkr@freddy.dk>
Comment thread RELEASENOTES.md
Comment on lines +8 to +10
### Include agentic workflows when updating system files from AL-Go or indirect templates

Update AL-Go System Files will now also include .md files from .github/workflows. This is the recommended location for storing agentic workflows (.md files).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make this a separate effort? Doesn't really seem related to GitHub enterprise support

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, but the people using this will be broken if I remove it...
Will try to figure out what I can do - maybe create another branch they can use and then remove it from here.

Comment on lines +1 to +3
# Using AL-Go for GitHub on GitHub Enterprise (GHE)

Repositories using AL-Go for GitHub are supported on **GitHub Enterprise Cloud with data residency** (also known as **GHE**, where your enterprise lives on a dedicated host like `https://<enterprise>.ghe.com`).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add a note in here that this is in preview (same way you did in the releasenotes)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do

> [!NOTE]
> The mirror-clone in step 2 reads from the **public** `github.com` template, which does not require authentication. Step 3 and step 4 target your enterprise host, using the credentials you authenticated with in step 1.
## Automated approach

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this tool sounds very useful, I am not sure we are allowed to / should reference third-party tools in our docs like this.

Could we document it just with the manual steps for now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure - will fix this - I will add a blog post about the tool then, no problem.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread Actions/AL-Go-Helper.ps1
}
}
$dependency | Add-Member -name "AuthTokenSecret" -MemberType NoteProperty -Value $token
$dependency | Add-Member -name "AuthTokenSecret" -MemberType NoteProperty -Value $useToken
Write-Host "Checking PR Build status for run $RunId in repository $Repository"

$workflowJobs = Invoke-CommandWithRetry -RetryCount 5 -FirstDelay 5 -MaxWaitBetweenRetries 60 -ScriptBlock {
$env:GH_HOST = ([Uri]$env:GITHUB_SERVER_URL).Host
Comment on lines +184 to +185
# Initialize in case no projects are found
$projectBuildInfo = @{ projectDependencies = @{} }
@freddydk

Copy link
Copy Markdown
Contributor Author

Closing this as it is being split in two PRs, where the data residency is here: #2407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants