diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 3ec300a3..9791fd2a 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -31,7 +31,7 @@ jobs: bundle install --jobs=4 - name: Update index run: | - bundle exec ruby Scripts/update-index.rb --pod "${{ inputs.pod }}" --version "${{ inputs.version }}" --action "${{ inputs.action }}" --path "${{ inputs.path }}" + bundle exec ruby Scripts/update-index.rb --sha "${{ inputs.sha }}" # - name: Deploy to Pages # if: github.event_name == 'schedule' @@ -58,22 +58,10 @@ jobs: on: workflow_dispatch: inputs: - pod: - description: 'The pod to be updated' + sha: + description: 'Spec repo commit SHA' required: true type: string - version: - description: 'The version of the pod to update' - required: true - type: string - podspec_path: - description: 'The path to the podspec in the spec repo' - required: true - type: string - action: - description: 'The action to perform' - required: true - type: string # repository_dispatch: # types: # - cronjob diff --git a/Scripts/update-index.rb b/Scripts/update-index.rb index 50b6681d..a0d32cd1 100644 --- a/Scripts/update-index.rb +++ b/Scripts/update-index.rb @@ -7,10 +7,7 @@ options = {} OptionParser.new do |opts| - opts.on("--pod POD_NAME", "The name of the Pod to update", String) - opts.on("--version POD_VERSION", "The version of the Pod to update", String) - opts.on("--action ACTION", "The action to perform", String) - opts.on("--path PODSPEC_PATH", "The relative path to the podspec in the master spec repo", String) + opts.on("--sha SHA", "SHA of the latest commit to the Specs repo", String) opts.on("-h", "--help", "Prints this help") do puts opts @@ -21,3 +18,15 @@ STDERR.puts 'CDN Indexer v3' puts "Options: #{options.inspect}" + +exit 1 unless (sha = options[:sha]) + +response = REST.get("https://api.github.com/repos/CocoaPods/Specs/commits/#{sha}") +if !response.ok? + puts "Failed to fetch commit: #{sha}" + puts response.body + exit 1 +end + +commit_info = JSON.parse(response.body) +pp commit_info