mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-08 23:18:10 -05:00
Get initial package version earlier in version.rb (#12535)
* Get initial package version earlier in version.rb Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust PR Generator workflow title. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Handle source hashes for checking for GitHub sources. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint workflow Signed-off-by: Satadru Pramanik <satadru@gmail.com> --------- Signed-off-by: Satadru Pramanik <satadru@gmail.com> Co-authored-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
committed by
GitHub
parent
cec62f528a
commit
e8912388ae
14
.github/workflows/Generate-PR.yml
vendored
14
.github/workflows/Generate-PR.yml
vendored
@@ -434,11 +434,17 @@ jobs:
|
||||
cat /tmp/pr.txt
|
||||
[[ $DRAFT_PR == 'true' ]] && export PR_DRAFT_FLAG='-d'
|
||||
PR_NUMBER=$(gh pr list -L 1 -s open -H ${{ inputs.branch || github.ref_name }} | cut -f1)
|
||||
echo "PR title is: $(echo "${{ inputs.pr_title || inputs.branch || github.ref_name }}" | sed -e "s/^'//" -e "s/'$//") ${PKG_DELTAS}"
|
||||
if [[ -z ${PR_NUMBER} ]]; then
|
||||
PR_NUMBER=$(gh pr create ${PR_DRAFT_FLAG} --reviewer chromebrew/active --title "$(echo "${{ inputs.pr_title || inputs.branch || github.ref_name }}" | sed -e "s/^'//" -e "s/'$//") ${PKG_DELTAS}" -F /tmp/pr.txt | rev | cut -d"/" -f1 | rev)
|
||||
PR_TITLE_INPUT="${{ inputs.pr_title }}"
|
||||
if [[ -z ${PR_TITLE_INPUT} ]]; then
|
||||
PR_TITLE="$(git log --oneline master..${{ inputs.branch || github.ref_name }} | grep -v "Build Run on\|Package File Update Run on" | tail -n 1 | cut -c 11-)"
|
||||
else
|
||||
gh pr edit --add-reviewer chromebrew/active --title "$(echo "${{ inputs.pr_title || inputs.branch || github.ref_name }}" | sed -e "s/^'//" -e "s/'$//") ${PKG_DELTAS}" -F /tmp/pr.txt
|
||||
PR_TITLE="${{ inputs.pr_title }}"
|
||||
fi
|
||||
echo "PR title is: $(echo "${PR_TITLE}" | sed -e "s/^'//" -e "s/'$//") ${PKG_DELTAS}"
|
||||
if [[ -z ${PR_NUMBER} ]]; then
|
||||
PR_NUMBER=$(gh pr create ${PR_DRAFT_FLAG} --reviewer chromebrew/active --title "$(echo "${PR_TITLE}" | sed -e "s/^'//" -e "s/'$//") ${PKG_DELTAS}" -F /tmp/pr.txt | rev | cut -d"/" -f1 | rev)
|
||||
else
|
||||
gh pr edit --add-reviewer chromebrew/active --title "$(echo "${PR_TITLE}" | sed -e "s/^'//" -e "s/'$//") ${PKG_DELTAS}" -F /tmp/pr.txt
|
||||
fi
|
||||
# Draft PRs can not be set to automerge.
|
||||
if [[ $DRAFT_PR == 'true' ]]; then
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env ruby
|
||||
# version.rb version 2.1 (for Chromebrew)
|
||||
# version.rb version 2.2 (for Chromebrew)
|
||||
|
||||
OPTIONS = %w[-h --help -j --json -u --update-package-files -v --verbose]
|
||||
|
||||
@@ -49,7 +49,11 @@ versions = []
|
||||
def get_version(name, homepage, source)
|
||||
# Determine if the source is a GitHub repository, but skip if there
|
||||
# is an anitya name mapping.
|
||||
unless source.nil? || source.is_a?(Hash) || %w[Pip].include?(@pkg.superclass.to_s) || CREW_ANITYA_PACKAGE_NAME_MAPPINGS.keys.find_index { |i| i == name }
|
||||
unless source.nil? || %w[Pip].include?(@pkg.superclass.to_s) || CREW_ANITYA_PACKAGE_NAME_MAPPINGS.keys.find_index { |i| i == name }
|
||||
if source.is_a?(Hash)
|
||||
source_arch = (@pkg.source_url.keys.map &:to_s).first
|
||||
source = @pkg.source_url[source_arch.to_sym]
|
||||
end
|
||||
source.sub!('www.', '')
|
||||
url = URI.parse(source)
|
||||
if url.host == 'github.com'
|
||||
@@ -181,6 +185,7 @@ if filelist.length.positive?
|
||||
puts "#{'-------'.ljust(package_field_length)}#{'------'.ljust(status_field_length)}#{'-------'.ljust(version_field_length)}#{'--------'.ljust(version_field_length)}----------" unless OUTPUT_JSON
|
||||
filelist.each do |filename|
|
||||
@pkg = Package.load_package(filename)
|
||||
cleaned_pkg_version = PackageUtils.get_clean_version(@pkg.version)
|
||||
if @pkg.is_fake?
|
||||
# Just skip is_fake packages.
|
||||
versions_updated[@pkg.name.to_sym] = 'Fake'
|
||||
@@ -351,7 +356,6 @@ if filelist.length.positive?
|
||||
version_status_string = 'Up to date.'.ljust(status_field_length).lightgreen
|
||||
end
|
||||
updatable_string = (updatable_pkg[@pkg.name.to_sym] == 'Yes' ? 'Yes'.lightgreen : 'No'.lightred) if updatable_string.nil?
|
||||
cleaned_pkg_version = PackageUtils.get_clean_version(@pkg.version)
|
||||
versions.push(package: @pkg.name, update_status: versions_updated[@pkg.name.to_sym], version: cleaned_pkg_version, upstream_version: upstream_version.chomp)
|
||||
|
||||
addendum_string = "#{@pkg.name} cannot be automatically updated: ".red + "#{updatable_pkg[@pkg.name.to_sym]}\n".purple unless updatable_pkg[@pkg.name.to_sym] == 'Yes'
|
||||
|
||||
Reference in New Issue
Block a user