From 433020ad9ebdac4035f5347af2f986cd3ed1e196 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Thu, 6 Jul 2023 11:40:22 -0400 Subject: [PATCH 1/4] tweak debug tools --- Gemfile | 2 +- lib/html_proofer.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 0e90658d..bc7aa30a 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem "ruby-lsp", "~> 0.3.2", group: :development gem "github_changelog_generator", "~> 1.16" -gem "awesome_print" +gem "amazing_print" gem "debug" if "#{RbConfig::CONFIG["MAJOR"]}.#{RbConfig::CONFIG["MINOR"]}".to_f >= 3.1 gem "rake" diff --git a/lib/html_proofer.rb b/lib/html_proofer.rb index 73c25681..bfc3c9dd 100644 --- a/lib/html_proofer.rb +++ b/lib/html_proofer.rb @@ -15,8 +15,11 @@ require "fileutils" if ENV.fetch("DEBUG", false) - require "awesome_print" require "debug" + begin + require "amazing_print" + rescue LoadError # rubocop:disable Lint/SuppressedException + end end module HTMLProofer From 7d5b923cd1855fe7e82e4068f2055c0ede8e5b7e Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Thu, 6 Jul 2023 11:44:18 -0400 Subject: [PATCH 2/4] add ruby version --- .ruby-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..e4604e3a --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.1 From e60996c7973800fc6bf1ff2190d0c3f9c916d86a Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Thu, 6 Jul 2023 11:40:30 -0400 Subject: [PATCH 3/4] :gem: 5.0.8 --- lib/html_proofer/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/html_proofer/version.rb b/lib/html_proofer/version.rb index 3b61d363..2b5ae8e2 100644 --- a/lib/html_proofer/version.rb +++ b/lib/html_proofer/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module HTMLProofer - VERSION = "5.0.7" + VERSION = "5.0.8" end From 301b582416480a02c2340a36eabbf96cfd388f65 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Thu, 6 Jul 2023 11:42:00 -0400 Subject: [PATCH 4/4] the usual workflow updates --- .github/workflows/automerge.yml | 28 ++--------- .github/workflows/lint.yml | 14 +++--- .github/workflows/tag_and_release.yml | 69 ++++----------------------- .github/workflows/test.yml | 16 ++----- 4 files changed, 25 insertions(+), 102 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 4b61205e..5a719f85 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -1,6 +1,7 @@ -name: PR auto-{approve,merge} +name: "Bot auto-{approve,merge}" on: + workflow_dispatch: pull_request_target: permissions: @@ -9,26 +10,5 @@ permissions: 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 }} + uses: yettoapp/actions/.github/workflows/automerge_dependabot.yml@main + secrets: inherit diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fceb2ae9..a1586b0e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,23 +1,23 @@ -name: Lint +name: Linting on: pull_request: + paths: + - "**/*.rb" permissions: contents: read jobs: - test: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ruby/setup-ruby@v1 + - name: Set up Ruby + uses: yettoapp/actions/setup-languages@main with: - ruby-version: 3.1 - bundler-cache: true - - - run: bundle install + ruby: true - name: Rubocop run: bundle exec rake rubocop diff --git a/.github/workflows/tag_and_release.yml b/.github/workflows/tag_and_release.yml index ace1bad5..5b45ffd2 100644 --- a/.github/workflows/tag_and_release.yml +++ b/.github/workflows/tag_and_release.yml @@ -1,4 +1,4 @@ -name: Tag and Release +name: Release on: workflow_dispatch: @@ -9,62 +9,11 @@ on: - "lib/html_proofer/version.rb" jobs: - release: - env: - GEM_NAME: html_proofer - 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 "actions@github.com" - 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 "actions@github.com" - 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 build - for gem in pkg/html-proofer-${{ steps.version-label.outputs.version }}*.gem ; do - gem push "$gem" --host https://rubygems.org - done + ruby: + uses: yettoapp/actions/.github/workflows/ruby_gem_release.yml@main + secrets: + rubygems_api_key: ${{ secrets.RUBYGEMS_API_BOT_KEY }} + gh_token: ${{ secrets.PUBLIC_PUSH_TO_PROTECTED_BRANCH }} + with: + gem_name: html_proofer + version_filepath: lib/html_proofer/version.rb diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f3ca3e6d..b0dbaf7a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test +name: CI on: pull_request: @@ -8,21 +8,15 @@ permissions: jobs: test: - env: - NOKOGIRI_USE_SYSTEM_LIBRARIES: true runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Ruby 3.1 - uses: ruby/setup-ruby@v1 + - name: Set up Ruby + uses: yettoapp/actions/setup-languages@main with: - ruby-version: 3.1 - bundler-cache: true - - - name: Install dependencies - run: bundle install + ruby: true - name: Run tests - run: bundle exec rake + run: bundle exec rake test