dev-cmd/man: modify '--fail-if-changed' to '--fail-if-not-changed'
This commit is contained in:
		
							parent
							
								
									c32ead1c97
								
							
						
					
					
						commit
						0754fabec6
					
				
							
								
								
									
										4
									
								
								.github/workflows/update-manpage.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/update-manpage.yml
									
									
									
									
										vendored
									
									
								
							@ -50,9 +50,7 @@ jobs:
 | 
			
		||||
            brew update-maintainers
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
          brew man
 | 
			
		||||
 | 
			
		||||
          if [ -n "$(git status --porcelain=v1 2>/dev/null)" ]; then
 | 
			
		||||
          if brew man --fail-if-not-changed; then
 | 
			
		||||
            git add "$GITHUB_WORKSPACE/README.md" \
 | 
			
		||||
                    "$GITHUB_WORKSPACE/docs/Manpage.md" \
 | 
			
		||||
                    "$GITHUB_WORKSPACE/manpages/brew.1" \
 | 
			
		||||
 | 
			
		||||
@ -24,9 +24,9 @@ module Homebrew
 | 
			
		||||
 | 
			
		||||
        *Note:* Not (yet) working on Apple Silicon.
 | 
			
		||||
      EOS
 | 
			
		||||
      switch "--fail-if-changed",
 | 
			
		||||
             description: "Return a failing status code if changes are detected in the manpage outputs. This "\
 | 
			
		||||
                          "can be used to notify CI when the manpages are out of date. Additionally, "\
 | 
			
		||||
      switch "--fail-if-not-changed",
 | 
			
		||||
             description: "Return a failing status code if no changes are detected in the manpage outputs. "\
 | 
			
		||||
                          "This can be used to notify CI when the manpages are out of date. Additionally, "\
 | 
			
		||||
                          "the date used in new manpages will match those in the existing manpages (to allow "\
 | 
			
		||||
                          "comparison without factoring in the date)."
 | 
			
		||||
      named_args :none
 | 
			
		||||
@ -42,19 +42,17 @@ module Homebrew
 | 
			
		||||
    args = man_args.parse
 | 
			
		||||
 | 
			
		||||
    Commands.rebuild_internal_commands_completion_list
 | 
			
		||||
    regenerate_man_pages(preserve_date: args.fail_if_changed?, quiet: args.quiet?)
 | 
			
		||||
    regenerate_man_pages(preserve_date: args.fail_if_not_changed?, quiet: args.quiet?)
 | 
			
		||||
    Completions.update_shell_completions!
 | 
			
		||||
 | 
			
		||||
    diff = system_command "git", args: [
 | 
			
		||||
      "-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "docs/Manpage.md", "manpages", "completions"
 | 
			
		||||
    ]
 | 
			
		||||
    if diff.status.success?
 | 
			
		||||
      puts "No changes to manpage or completions output detected."
 | 
			
		||||
    elsif args.fail_if_changed?
 | 
			
		||||
      puts "Changes to manpage or completions detected:"
 | 
			
		||||
      puts diff.stdout
 | 
			
		||||
      Homebrew.failed = true
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    return unless diff.status.success?
 | 
			
		||||
 | 
			
		||||
    puts "No changes to manpage or completions output detected."
 | 
			
		||||
    Homebrew.failed = true if args.fail_if_not_changed?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def regenerate_man_pages(preserve_date:, quiet:)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user