Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ead53d0c8a | |||
| e2b13747b8 | |||
| d0c3f534f8 | |||
| 68107d3ea8 |
@@ -20,6 +20,7 @@ ENV LANGUAGE en_US.UTF-8
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
COPY bin/emit_telemetry /emit_telemetry
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
|
||||
@@ -12,3 +12,4 @@ gem "github-pages", "= 225"
|
||||
# even though it is included in the original GitHub Pages build infrastructure.
|
||||
gem "jekyll-include-cache", "= 0.2.1"
|
||||
gem "jekyll-octicons", "~> 14.2"
|
||||
gem "faraday", "~> 1.10"
|
||||
|
||||
+1
-1
@@ -27,4 +27,4 @@ inputs:
|
||||
default: ${{ github.token }}
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'docker://ghcr.io/actions/jekyll-build-pages:v1.0.2'
|
||||
image: 'docker://ghcr.io/actions/jekyll-build-pages:feature-emit-telemetry'
|
||||
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#! /usr/bin/env ruby
|
||||
|
||||
require "faraday"
|
||||
require "faraday/retry"
|
||||
require "json"
|
||||
|
||||
ACTION_NWO = ENV["GITHUB_ACTION_REPOSITORY"]
|
||||
REPOSITORY_NWO = ENV["GITHUB_REPOSITORY"]
|
||||
GITHUB_RUN_ID = ENV["GITHUB_RUN_ID"]
|
||||
GITHUB_TOKEN = ENV["INPUT_TOKEN"]
|
||||
TELEMETRY_URL = "https://api.github.com/repos/#{REPOSITORY_NWO}/pages/telemetry"
|
||||
RETRY_COUNT = 3
|
||||
|
||||
RETRY_OPTIONS = {
|
||||
max: RETRY_COUNT,
|
||||
methods: [:post],
|
||||
retry_statuses: [500, 502, 503, 504],
|
||||
interval: 1,
|
||||
backoff_factor: 2,
|
||||
}
|
||||
|
||||
begin
|
||||
connection = Faraday.new { |f| f.request :retry, RETRY_OPTIONS }
|
||||
response = connection.post(
|
||||
TELEMETRY_URL,
|
||||
{ github_run_id: GITHUB_RUN_ID }.to_json,
|
||||
{
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: "Bearer #{GITHUB_TOKEN}",
|
||||
'Content-type': 'application/json',
|
||||
'User-Agent': "#{ACTION_NWO} Faraday #{Faraday::VERSION}",
|
||||
},
|
||||
)
|
||||
|
||||
if response.success?
|
||||
STDERR.puts "Sending telemetry for run id #{GITHUB_RUN_ID}"
|
||||
else response.success?
|
||||
STDERR.puts "Failed to emit pages build telemetry to #{TELEMETRY_URL} : returned status code: #{response.status} after #{RETRY_COUNT + 1} attempts"
|
||||
STDERR.puts response.body if response.body
|
||||
end
|
||||
rescue e
|
||||
STDERR.puts "Failed to emit pages build telemetry: #{e}"
|
||||
end
|
||||
@@ -5,9 +5,9 @@ if [ "local" = "$1" ]; then
|
||||
export PAGES_REPO_NWO=actions/jekyll-build-pages
|
||||
export JEKYLL_BUILD_REVISION=JEKYLL_BUILD_REVISION
|
||||
|
||||
for dir in $(ls test_projects)
|
||||
for dir in test_projects/*
|
||||
do
|
||||
bundle exec github-pages build --verbose -s test_projects/$dir -d test_projects/$dir/_expected
|
||||
bundle exec github-pages build --verbose -s "$dir" -d "$dir/_expected"
|
||||
done
|
||||
else
|
||||
act -b -s GITHUB_TOKEN -j record-expected-output
|
||||
|
||||
@@ -35,3 +35,5 @@ fi
|
||||
|
||||
cd "$PAGES_GEM_HOME"
|
||||
$GITHUB_PAGES build "$VERBOSE" "$FUTURE" --source "$SOURCE_DIRECTORY" --destination "$DESTINATION_DIRECTORY"
|
||||
|
||||
/emit_telemetry
|
||||
|
||||
Reference in New Issue
Block a user