File tree Expand file tree Collapse file tree 6 files changed +65
-2
lines changed Expand file tree Collapse file tree 6 files changed +65
-2
lines changed Original file line number Diff line number Diff line change 5454 - name : Run NuGet sync script
5555 run : python scripts/sync_nuget.py
5656 env :
57- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57+ GITHUB_TOKEN : ${{ secrets.GH_NUGET_TOKEN }}
5858 # Add any other environment variables needed by your script
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ class NuGetSyncer:
77 def __init__ (self ):
88 self .NUGET_FEED_URL = "https://pkgs.dev.azure.com/Keyfactor/_packaging/KeyfactorPackages/nuget/v3/index.json"
99 self .GITHUB_NUGET_URL = "https://nuget.pkg.github.com/keyfactor/index.json"
10- self .GITHUB_TOKEN = os .getenv ("GITHUB_TOKEN" )
10+ self .GITHUB_TOKEN = os .getenv ("GH_NUGET_TOKEN" , os . getenv ( " GITHUB_TOKEN") )
1111 self .TMP_DIR = "../nupkgs"
1212 self .PACKAGES_YML = "../packages.yml"
1313 self .allowed_packages = self .load_allowed_packages ()
Original file line number Diff line number Diff line change 1+ // Repository reference
2+ data "github_repository" "nuget_repo" {
3+ full_name = " Keyfactor/public-nuget-packages"
4+ }
5+
6+ // Create the Azure DevOps PAT secret for NuGet package downloads
7+ resource "github_actions_secret" "az_devops_pat" {
8+ repository = data. github_repository . nuget_repo . name
9+ secret_name = " AZ_DEVOPS_PAT"
10+ plaintext_value = var. az_devops_pat
11+ }
12+
13+ // Create the GitHub PAT secret for GitHub Package uploads
14+ // Note: This is separate from the built-in GITHUB_TOKEN
15+ resource "github_actions_secret" "github_pat" {
16+ repository = data. github_repository . nuget_repo . name
17+ secret_name = " GH_NUGET_TOKEN"
18+ plaintext_value = var. repo_github_pat
19+ }
20+
Original file line number Diff line number Diff line change 1+ // Outputs
2+ output "repository_name" {
3+ value = data. github_repository . nuget_repo . name
4+ }
5+
6+ output "secrets_configured" {
7+ value = [
8+ github_actions_secret . az_devops_pat . secret_name ,
9+ github_actions_secret . github_pat . secret_name
10+ ]
11+ }
Original file line number Diff line number Diff line change 1+ // GitHub provider configuration
2+ terraform {
3+ required_providers {
4+ github = {
5+ source = " integrations/github"
6+ version = " ~> 5.0"
7+ }
8+ }
9+ }
10+
11+ // Configure the GitHub Provider
12+ provider "github" {
13+ owner = " Keyfactor"
14+ }
Original file line number Diff line number Diff line change 1+ // Variables
2+ # variable "github_token" {
3+ # description = "GitHub personal access token with repo permissions"
4+ # type = string
5+ # sensitive = true
6+ # }
7+
8+ variable "az_devops_pat" {
9+ description = " Azure DevOps personal access token with package read permissions"
10+ type = string
11+ sensitive = true
12+ }
13+
14+ variable "repo_github_pat" {
15+ description = " GitHub personal access token with package write permissions"
16+ type = string
17+ sensitive = true
18+ }
You can’t perform that action at this time.
0 commit comments