Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address some typos #780

Merged
merged 3 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
time: "09:00"
timezone: "Etc/UTC"
open-pull-requests-limit: 10

- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: daily
time: "09:00"
timezone: "Etc/UTC"
open-pull-requests-limit: 10
allow:
- dependency-name: "*"
dependency-type: "production"
34 changes: 34 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PR auto-{approve,merge}

on:
pull_request_target:

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
name: Dependabot
runs-on: ubuntu-latest

if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Fetch Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve Dependabot PR
if: ${{steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'}}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Merge Dependabot PR
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true

- run: bundle install

- name: Rubocop
run: bundle exec rake rubocop
70 changes: 70 additions & 0 deletions .github/workflows/tag_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Tag and Release

on:
workflow_dispatch:
push:
branches:
- main
paths:
- "lib/html_proofer/version.rb"

jobs:
release:
env:
GEM_NAME: tailwind_merge
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_BOT_KEY }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Ruby 3.1
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true

- name: Configure Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "Actions Auto Build"

- name: Get current version
id: version-label
run: |
VERSION=$(grep VERSION lib/html_proofer/version.rb | head -n 1 | cut -d'"' -f2)
echo "version=${VERSION}" >> $GITHUB_OUTPUT

- name: Create tag
run: |
git tag -a v${{ steps.version-label.outputs.version }} -m "Release v${{ steps.version-label.outputs.version }}"
git push origin --tags

- name: Generate CHANGELOG.md
id: changelog
run: script/generate_changelog

- name: Commit & Push Changelog
run: |
git config --local user.email "[email protected]"
git config --local user.name "Actions Auto Build"
git add -f CHANGELOG.md
git commit -m "docs: update changelog" || true
git push

- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ steps.version-label.outputs.version }} --generate-notes

- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
bundle exec rake package
for gem in pkg/html-proofer-${{ steps.version-label.outputs.version }}*.gem ; do
gem push "$gem" --host https://rubygems.org
done
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Test

on:
pull_request:
push:
branches:
- main

permissions:
contents: read
Expand All @@ -17,14 +14,15 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Install libxslt and libxml2
run: sudo apt-get install libxslt-dev libxml2-dev

- name: Set up Ruby 3.1
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true

- name: Install dependencies
run: bundle install

- name: Run tests
run: bundle exec rake
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ source "https://rubygems.org"
gemspec

gem "ruby-lsp", "~> 0.3.2", group: :development

gem "github_changelog_generator", "~> 1.16"
8 changes: 4 additions & 4 deletions lib/html_proofer/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ def parse_cli_options(args)
@options[long_opt_symbol] = parse_json_option("typhoeus", arg, symbolize_names: false)
end

set_option(opts, "--hydra <CONFIG>") do |long_opt_symbol, _list|
@options[long_opt_symbol] = parse_json_option("hydra", arg, symbolize_names: false)
set_option(opts, "--hydra <CONFIG>") do |long_opt_symbol, arg|
@options[long_opt_symbol] = parse_json_option("hydra", arg, symbolize_names: true)
end

set_option(opts, "--cache <CONFIG>") do |long_opt_symbol, _list|
@options[long_opt_symbol] = parse_json_option("cache", arg, symbolize_names: false)
set_option(opts, "--cache <CONFIG>") do |long_opt_symbol, arg|
@options[long_opt_symbol] = parse_json_option("cache", arg, symbolize_names: true)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/html_proofer/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module HTMLProofer
VERSION = "5.0.1"
VERSION = "5.0.2"
end
2 changes: 1 addition & 1 deletion script/generate_changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

CHANGELOG_GITHUB_TOKEN="$GITHUB_CHANGELOG_TOKEN" github_changelog_generator -u gjtorikian -p html-proofer
CHANGELOG_GITHUB_TOKEN="$GITHUB_TOKEN" bundle exec github_changelog_generator -u gjtorikian -p tailwind_merge
11 changes: 11 additions & 0 deletions spec/html-proofer/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@
it "supports hydra" do
http = make_bin(%(--hydra '{"max_concurrency": 5}' http://www.github.com --as-links))
expect(http.scan(/max_concurrency is invalid/).count).to(eq(0))
expect(http.scan(/successfully/).count).to(eq(1))
end
end

context "when dealing with cache" do
it "basically works" do
new_time = Time.local(2022, 1, 6, 12, 0, 0)
Timecop.freeze(new_time) do
http = make_bin(%(--cache '{"timeframe": { "external": "1d"}}' http://www.github.com --as-links))
expect(http.scan(/successfully/).count).to(eq(1))
end
end
end
end