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

Remove extra logs #60

Merged
merged 5 commits into from
Sep 30, 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
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,34 @@ It procuces an output similar to below
- [#4526](https://github.com/AFNetworking/AFNetworking/pull/4526): Remove unnecessary __block by [kinarobin](https://github.com/kinarobin)


### Action

When using the github action these are the inputs and outputs for the tool

#### Inputs

| Input | Default | Description |
--- | --- | ---
| token | github.token | The token used for github API |
| outputFile | * | The file to output to. If not provided only the action output is generated |
| since | * | The tag to generate the changelog since |
| sinceLatestRelease | * | `true`/`false` whether to generate since the latest release |
| complete | * | `true`/`false` whether to generate the complete changelog |
| nextTag | * | The next tag to bundle all the untagged pull requests into |
| filter | * | Filter regular expression to ignore all matching pull requests from the changelog |
| labels | * | Labels to group pull requests by |
| excludedLabels | * | Labels to exclude from the changelog |
| branch | * | The target branch for the changelog. When provided only pull requests merged into the branch are included |
| includeUntagged | `true` | `true`/`false` whether to include untagged pull requests in the changelog |
| verbose | * | `true`/`false` Whether to enable verbose logging. The verbose logs also become part of the outputs |
| use-compiled | `true` | `true`/`false` Whether to use the precompiled executable or not. This is never used for linux. |

#### Outputs

| Input | Description |
--- | --- | ---
| changelog | The changelog generated during the run |

#### Environment Variables

`CHANGELOG_GENERATED_VALUE` : Contains the changelog generated during run
2 changes: 1 addition & 1 deletion Sources/ChangeLogGenerator/Fetcher/GitHub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ extension GitHub {
/// - maximumNumberOfPages: The maximum number of pages to fetch
func fetchComparison(from base: String, to head: String, maximumNumberOfPages: Int? = nil) async throws -> Comparison {
let url: URL = try createBaseUrl(for: .compare(base, head))
Logger.log("Fetching comparison from \(url)")
Logger.log(level: .verbose, "Fetching comparison from \(url)")
let fetcher = ComparisonFetcher(
url: url,
headers: headers,
Expand Down
2 changes: 1 addition & 1 deletion Sources/ChangeLogGenerator/Generator/Generator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public struct Generator {
/// - maximumNumberOfPages: maximum number of pages to load
/// - completion: will finish with a changelog string
public func generateChangeLogSince(tag: String, on branch: String? = nil) async throws -> String {
Logger.log("generating since \(tag) on branch \(branch ?? "nil")")
Logger.log(level: .verbose, "generating since \(tag) on branch \(branch ?? "nil")")
let tags = try await GitHub(repository: repository, token: token)
.fetch(from: .tags, maximumNumberOfPages: maximumNumberOfPages) { (tags: [Tag]) -> Bool in
tags.contains { $0.name == tag } == false
Expand Down
10 changes: 5 additions & 5 deletions Sources/changelog/Commands/Generate.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Generate.swift
//
//
//
// Created by Mahmood Tahir on 2021-01-19.
//
Expand Down Expand Up @@ -126,22 +126,22 @@ struct Generate: ParsableCommand {
let changelog: String
switch type {
case .complete:
Logger.log("Fetch complete changelog")
Logger.log(level: .verbose, "Fetch complete changelog")
changelog = try await generator.generateCompleteChangeLog()
case .sinceLatestRelease:
Logger.log("Fetch since latest release")
Logger.log(level: .verbose, "Fetch since latest release")
changelog = try await generator.generateChangeLogSinceLatestRelease(on: branch)
case .sinceTag:
guard let tag = tag else {
throw GenerateError.missingTag
}
Logger.log("Fetch since \(tag)")
Logger.log(level: .verbose, "Fetch since \(tag)")
changelog = try await generator.generateChangeLogSince(tag: tag, on: branch)
case .milestone:
guard let milestone = milestone else {
throw GenerateError.missingMilestone
}
Logger.log("Fetch milestone \(milestone)")
Logger.log(level: .verbose, "Fetch milestone \(milestone)")
changelog = try await generator.generateChangeLogFor(milestone: milestone)
}

Expand Down
23 changes: 16 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ inputs:
outputs:
changelog:
description: the generated changelog
value: ${{ steps.generate.outputs.changelog }}
value: ${{ steps.set-output.outputs.changelog }}

runs:
using: "composite"
steps:
- id: generate
- name: Generate
id: generate
run: |
repository="${{ github.repository }}"
token="${{ inputs.token }}"
Expand Down Expand Up @@ -177,11 +178,19 @@ runs:

changelog=$("${command[@]}")

# Escape the special characters so that multiline output is supported
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
# Add output to environment

echo "::set-output name=changelog::$changelog"
echo 'CHANGELOG_GENERATED_VALUE<<EOF' >> $GITHUB_ENV
echo "$changelog" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV

shell: bash

- name: Set output
id: set-output
uses: actions/github-script@v6
with:
script: |
const { CHANGELOG_GENERATED_VALUE } = process.env

core.setOutput('changelog', CHANGELOG_GENERATED_VALUE)
Binary file modified changelog
Binary file not shown.