-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from kingdonb/action
Add GitHub Action workflows
- Loading branch information
Showing
15 changed files
with
331 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
LINE_COUNT=$(wc -l < pr-summary.csv) | ||
|
||
if [ "$LINE_COUNT" -gt 1 ]; then | ||
echo "Issues found in PR. Attaching pr-summary.csv for review..." | ||
else | ||
echo "No direct issues found in PR. Attaching baseline-unresolved.csv for reference..." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
LINE_COUNT=$(wc -l < pr-summary.csv) | ||
|
||
if [ "$LINE_COUNT" -le 1 ]; then | ||
# Using GitHub CLI to comment on the PR. | ||
gh pr comment ${{ github.event.pull_request.number }} --body "Warning: Some unresolved baseline issues are present. Please check the attached baseline-unresolved.csv." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Test Action Workflow | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
prNumber: | ||
description: 'PR number to test against' | ||
required: true | ||
default: '1573' | ||
|
||
jobs: | ||
test-action: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Ruby 3.0 | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.0 | ||
bundler-cache: true | ||
|
||
- name: Run the action | ||
uses: ./action/ | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
prNumber: ${{ github.event.inputs.prNumber }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Link Checker | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
check-links: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Ruby 3.0 | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.0 | ||
bundler-cache: true | ||
|
||
- name: Run main target | ||
run: make main | ||
|
||
- name: Clean cache | ||
run: make clean-cache | ||
|
||
- name: Run with preview | ||
run: make run_with_preview | ||
|
||
- name: Normalize reports | ||
run: make normalize | ||
|
||
- name: Run summary | ||
id: run-summary | ||
run: make summary | ||
continue-on-error: true | ||
|
||
- name: Check summary results | ||
run: ./.github/scripts/check_summary.sh | ||
if: steps.run-summary.outcome == 'failure' | ||
|
||
- name: Comment on PR if necessary | ||
run: ./.github/scripts/comment_on_pr.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload pr-summary.csv | ||
uses: actions/upload-artifact@v3 | ||
if: always() && steps.run-summary.outcome == 'failure' | ||
with: | ||
name: pr-summary | ||
path: pr-summary.csv | ||
|
||
- name: Upload baseline-unresolved.csv | ||
uses: actions/upload-artifact@v3 | ||
if: always() && steps.run-summary.outcome == 'success' | ||
with: | ||
name: baseline-unresolved | ||
path: baseline-unresolved.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
module CacheHelper | ||
def self.get_cache_path(url) | ||
uri = URI(url) | ||
cache_path = "cache" + uri.path | ||
|
||
cache_path = File.join("cache", uri.path) | ||
# If the path doesn't have a common file extension, treat it as a directory. | ||
unless cache_path.match(/\.(html|xml|json|txt|js|css|jpg|jpeg|png|gif)$/i) | ||
cache_path += "/index.html" | ||
cache_path = File.join(cache_path, "index.html") | ||
end | ||
|
||
cache_path | ||
end | ||
|
||
def self.write_to_cache(url, content, status) | ||
cache_path = get_cache_path(url) | ||
data = { content: content, status: status } | ||
File.write(cache_path, JSON.dump(data)) | ||
end | ||
|
||
def self.read_from_cache(url) | ||
cache_path = get_cache_path(url) | ||
data = JSON.parse(File.read(cache_path)) | ||
[data["content"], data["status"]] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.