Skip to content

Commit

Permalink
Bug fixing for releaser (#6)
Browse files Browse the repository at this point in the history
* Run webpack rake task for v0.27

* Add i18n environment variables to local rspec run

* Replace ByTitle with ByQuery

* Fix typo
  • Loading branch information
andreslucena authored Jul 16, 2024
1 parent 415a7c4 commit e3ed6e8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/decidim/maintainers_toolbox/github_manager/querier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module GithubManager
module Querier
autoload :ByIssueId, "decidim/maintainers_toolbox/github_manager/querier/by_issue_id"
autoload :ByLabel, "decidim/maintainers_toolbox/github_manager/querier/by_label"
autoload :ByTitle, "decidim/maintainers_toolbox/github_manager/querier/by_title"
autoload :ByQuery, "decidim/maintainers_toolbox/github_manager/querier/by_query"
autoload :RelatedIssues, "decidim/maintainers_toolbox/github_manager/querier/related_issues"
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ module Querier
# Makes a GET request for the list of Issues or Pull Requests in GitHub.
#
# @param token [String] token for GitHub authentication
# @param title [String] the title that we want to search by
# @param state [String] the state of the issue. By default is "open"
# @param query [Hash] the query to search
#
# @see https://docs.github.com/en/rest/issues/issues#list-repository-issues GitHub API documentation
class ByTitle < Decidim::MaintainersToolbox::GithubManager::Querier::Base
def initialize(title:, token:, state: "open")
@title = title
class ByQuery < Decidim::MaintainersToolbox::GithubManager::Querier::Base
def initialize(token:, query: {})
@token = token
@state = state
@query = query
end

# Makes the GET request and parses the response of an Issue or Pull Request in GitHub
Expand All @@ -31,14 +29,12 @@ def call

private

attr_reader :title, :state
attr_reader :query

def headers
{
title: title,
state: state,
per_page: 100
}
}.merge(query)
end

# Parses the response of an Issue or Pull Request in GitHub
Expand Down
10 changes: 7 additions & 3 deletions lib/decidim/maintainers_toolbox/releaser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "open3"
require_relative "github_manager/poster"
require_relative "github_manager/querier/by_title"
require_relative "github_manager/querier/by_query"
require_relative "changelog_generator"

module Decidim
Expand Down Expand Up @@ -37,11 +37,15 @@ def call

run("git checkout #{release_branch}")
run("git pull origin #{release_branch}")

bump_decidim_version
run("bin/rake update_versions")

run("bin/rake patch_generators")

run("bin/rake bundle")
run("npm install")
run("bin/rake webpack") if Dir.exists?("decidim_app-design")

check_tests

Expand Down Expand Up @@ -176,7 +180,7 @@ def old_version_number
# @return [void]
def check_tests
puts "Running specs"
output, status = capture("bin/rspec")
output, status = capture("bin/rspec", { "ENFORCED_LOCALES" => "en,ca,es", "SKIP_NORMALIZATION" => "true" })

unless status.success?
run("git restore .")
Expand Down Expand Up @@ -244,7 +248,7 @@ def run(cmd, out: $stdout)
#
# @return [Boolean] - true if there is any open PR
def pending_crowdin_pull_requests?
pull_requests = Decidim::MaintainersToolbox::GithubManager::Querier::ByTitle.new(token: @token, title: "New Crowdin updates").call
pull_requests = Decidim::MaintainersToolbox::GithubManager::Querier::ByQuery.new(token: @token, query: { title: "New Crowdin updates", creator: "decidim-bot" }).call
pull_requests.any?
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
require "decidim/maintainers_toolbox/github_manager/querier"
require "webmock/rspec"

describe Decidim::MaintainersToolbox::GithubManager::Querier::ByTitle do
let(:querier) { described_class.new(token: "abc", title: title, state: state) }
describe Decidim::MaintainersToolbox::GithubManager::Querier::ByQuery do
let(:querier) { described_class.new(token: @token, query: { title: "Fix whatever" }) }

let(:title) { "Fix whatever" }
let(:state) { "open" }

let(:stubbed_url) { "https://api.github.com/repos/decidim/decidim/issues?per_page=100&state=open&title=Fix%20whatever" }
let(:stubbed_url) { "https://api.github.com/repos/decidim/decidim/issues?per_page=100&title=Fix%20whatever" }
let(:stubbed_headers) { {} }

before do
Expand Down

0 comments on commit e3ed6e8

Please sign in to comment.