paketo-buildpacks / github-config

Common repository configuration
Apache License 2.0
8 stars 12 forks source link

Limit show receipts #940

Closed pacostas closed 5 months ago

pacostas commented 5 months ago

Summary

This PR adds an option called receipts-show-limit where in case the limit, which corresponds to the number of items of the array for each removed, build or added, has been exceeded, then it hides the receipts by replacing them with the message ❌ TOO large to include

E.g if we set the limit to 0 it will show below readme file

    ## Images
    Build: `build_image_url`
    Run: `run_image_url`

    ## Patched USNs
    No USNs patched in this release.

    ## Build Image Package Changes
    ### Added
❌ TOO large to include
```

### Modified

```
❌ TOO large to include
```

### Removed
```
❌ TOO large to include
```

## Run Image Package Changes
### Added
```
❌ TOO large to include
```

### Modified
```
❌ TOO large to include
```

### Removed
```
❌ TOO large to include
```
Instead of below one. 
```markdown
    ## Images
    Build: `build_image_url`
    Run: `run_image_url`

    ## Build Image Package Changes
    ### Added
liba-dev 2.22.2-222.222 (PURL: pkg:purl/purl/linux)
```

### Modified
```
liba-dev 1.11.1-111.111 ==> 2.22.2-222.222 (PURL: pkg:previous/purl/linux ==> pkg:previous/purl/linux)
```

### Removed
```
liba-dev 2.22.2-222.222 (PURL: pkg:purl/purl/linux)
```

## Run Image Package Changes
### Added
```
liba-dev 2.22.2-222.222 (PURL: pkg:purl/purl/linux)
```

### Modified
```
liba-dev 1.11.1-111.111 ==> 2.22.2-222.222 (PURL: pkg:previous/purl/linux ==> pkg:previous/purl/linux)
```

### Removed
```
liba-dev 2.22.2-222.222 (PURL: pkg:purl/purl/linux)
```


In case the value has not been set, it fallbacks to the current behaviour by showing all the receipts.

## Use Cases
<!-- An explanation of the use cases your change enables -->
This is useful to avoid the Github error while posting the release notes. Github has a specific number of characters that allows the length of release notes to be. By setting a limit on whether the receipts if overcome it will show them or not, we avoid getting that error, especially when we newly add a stack.

## Merge after
* https://github.com/paketo-buildpacks/github-config/pull/939

## Checklist
<!-- Please confirm the following -->
* [x] I have viewed, signed, and submitted the Contributor License Agreement.
* [ ] I have linked issue(s) that this PR should close using keywords or the Github UI (See [docs](https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue))
* [x] I have added an integration test, if necessary.
* [x] I have reviewed the [styleguide](https://github.com/paketo-buildpacks/community/blob/main/STYLEGUIDE.md) for guidance on my code quality.
* [x] I'm happy with the commit history on this PR (I have rebased/squashed as needed).
mhdawson commented 5 months ago

And to add a bit of additional context, this was needed when we added release notes for the ubi stack.

pacostas commented 5 months ago

@ForestEckhardt Rebased it

sophiewigmore commented 4 months ago

@pacostas this change is causing an error I have in a repo using this action:

"--receipts-show-limit" ""
2024/06/19 20:13:04 failed converting receipts show limit string to int: strconv.Atoi: parsing "": invalid syntax
pacostas commented 4 months ago

@sophiewigmore Yes, I've opened a PR that fixes that https://github.com/paketo-buildpacks/github-config/pull/952