-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PTFE-1063 reusable workflow to disallow the merge of large files (#52)
- Loading branch information
Showing
4 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
|
||
# This workflow is a reusable workflow meant to be called on pull_request events. | ||
# The goal is to check the files in the pull request to make sure they respect the file size limit. | ||
# If the file size limit is exceeded, and the file has not been commited via git lfs, then | ||
# the workflow will fail, a label will be added to the pull request along with a comment. | ||
|
||
name: lfs-warning | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
filesizelimit: | ||
description: 'The file size limit' | ||
required: false | ||
default: 1MB | ||
type: string | ||
labelname: | ||
description: 'The label name' | ||
required: false | ||
default: bug | ||
type: string | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: read | ||
|
||
jobs: | ||
lfs-warning: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: lfs warning | ||
uses: ppremk/[email protected] | ||
with: | ||
filesizelimit: ${{ inputs.filesizelimit }} | ||
labelName: ${{ inputs.labelname }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Git LFS warning | ||
|
||
The `lfs-warning.yaml` workflow will check if the files committed | ||
in a pull request are properly tracked by Git LFS when needed. | ||
|
||
## Usage | ||
|
||
This workflow can be called as a job in any workflow that needs, | ||
for example: | ||
|
||
```yaml | ||
# my-workflow.yaml | ||
on: pull_request | ||
|
||
jobs: | ||
lfs-warning: | ||
uses: scality/workflows/.github/workflows/lfs-warning.yaml@v1 | ||
``` | ||
## Inputs | ||
Additional inputs to modify the default behavior of the workflow. | ||
| Name | Description | Default | | ||
| --------------- | ------------------------------------------ | ------- | | ||
| `filesizelimit` | Maximum file size before warning | `1MB` | | ||
| `labelname` | Label name to use when a warning is issued | `bug` | | ||
|
||
```yaml | ||
# my-workflow.yaml | ||
on: pull_request | ||
jobs: | ||
lfs-warning: | ||
uses: scality/workflows/.github/workflows/lfs-warning.yaml@v1 | ||
with: | ||
filesizelimit: 10MB | ||
labelname: 'my-label' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters