-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update readme w documentation and an example
- Loading branch information
Gonzalo Naveira
committed
Oct 21, 2021
1 parent
4a84137
commit f7eca11
Showing
1 changed file
with
69 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 |
---|---|---|
@@ -1 +1,69 @@ | ||
# Image Resizing | ||
# Github Action Image Resizing | ||
|
||
This is a Github Action for resizing images in your project. | ||
|
||
In main.py you will find the implementation of the code to resize the images using the library `Pillow`. | ||
|
||
|
||
# Inputs | ||
|
||
| Input | Description | Required | Default | | ||
| ----------- | ----------- | ----------- | ----------- | | ||
| `DEBUG` | Will print debug messages (True/False) | `false` | False | ||
| `IMAGES_MAX_WIDTH` | Max width of the images | `true` | ||
| `IMAGES_QUALITY` | Quality of the reized image 0-100 | `false` | 100 | ||
| `IMAGES_FORMATS` | Formats we are going to resize (Comma separated) | `true` | "jpg, jpge, png" | ||
| `IMAGES_DIRECTORIES` | Directories we are going to be looking the images in (Comma separated) | `true` | | ||
| `IMAGES_PREFIX` | Prefix to add when renaming the images | `false` |"" | ||
| `IMAGES_SUFFIX` | Suffix to add when renaming the images | `false` |"" | ||
|
||
|
||
|
||
# Output | ||
|
||
| Output | Description | | ||
| ----------- | ----------- | | ||
| `result` | Images that were resized) | | ||
|
||
|
||
# Example of Usage | ||
|
||
This workflow could be used to re size the images on every `pull_request`. After this it will push the commit to the same PR. | ||
|
||
``` | ||
name: Resize images | ||
on: [pull_request] | ||
jobs: | ||
build: | ||
name: Github Action Image Resizing | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Resize Images | ||
id: resize-images | ||
# You can change the version as well | ||
uses: gonzalonaveira/gh-image-resizing@master | ||
with: | ||
IMAGES_MAX_WIDTH: "1500" | ||
IMAGES_QUALITY: "90" | ||
IMAGES_FORMATS: "jpg, jpge, png" | ||
IMAGES_DIRECTORIES: "public/assets/blog/images" | ||
- name: Commit changes | ||
uses: EndBug/add-and-commit@v4 | ||
with: | ||
add: 'public/' | ||
author_name: "github-actions[bot]" | ||
author_email: "github-actions@users.noreply.github.com" | ||
message: | | ||
Images Reszied by Github action | ||
${{steps.resize-images.outputs.result}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
``` |