Skip to content

Commit

Permalink
detect-and-upload: use $GITHUB_TOKEN when available (#421)
Browse files Browse the repository at this point in the history
* Update buildpack-tagger.rb

* Update task.yml
  • Loading branch information
arjun024 authored Feb 13, 2025
1 parent 3a94c0a commit c1b968e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tasks/detect-and-upload/buildpack-tagger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ def run!
tag_to_add = "v#{File.read('VERSION')}".strip
puts "Tag to add: #{tag_to_add}"

existing_tags = Octokit.tags("#{git_repo_org}/#{buildpack_name}").map(&:name)
git_repo = "#{git_repo_org}/#{buildpack_name}"

if ENV['GITHUB_TOKEN']
client = Octokit::Client.new(access_token: ENV['GITHUB_TOKEN'])
existing_tags = client.tags(git_repo).map(&:name)
else
existing_tags = Octokit.tags(git_repo).map(&:name)
end
puts "Existing tags: #{existing_tags}"

Dir.mkdir("../buildpack-artifacts/uncached")
Expand Down
1 change: 1 addition & 0 deletions tasks/detect-and-upload/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ params:
CF_STACK:
BUILDPACK_NAME:
GIT_REPO_ORG:
GITHUB_TOKEN:

0 comments on commit c1b968e

Please sign in to comment.