Skip to content

Commit 093e7ab

Browse files
author
Jose Then
committed
first commit
0 parents  commit 093e7ab

File tree

5 files changed

+69
-0
lines changed

5 files changed

+69
-0
lines changed

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM alpine:3.6
2+
3+
LABEL repository="https://github.com/groupninemedia/filter-git-diff"
4+
LABEL homepage="https://github.com/groupninemedia/filter-git-diff"
5+
LABEL maintainer="GroupNineMedia <devops@groupninemedia.com>"
6+
LABEL "com.github.actions.name"="Filter Git Diff"
7+
LABEL "com.github.actions.description"="A Github Action that will filter a git diff for the specified file/dir using regex"
8+
LABEL "com.github.actions.icon"="filter"
9+
LABEL "com.github.actions.color"="black"
10+
11+
RUN apk --update add git less \
12+
rm -rf /var/lib/apt/lists/* && \
13+
rm /var/cache/apk/*
14+
15+
ENV PATH="/usr/local/bin:${PATH}"
16+
17+
COPY bin /usr/local/bin/
18+
COPY entrypoint.sh /entrypoint.sh
19+
20+
ENTRYPOINT ["/entrypoint.sh"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Group Nine Media
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Filter Git Diff Action
2+
A Github Action that will filter a git diff for the specified file/dir using regex.
3+
4+
---
5+
6+
## Example Usage
7+
```workflow
8+
action "Git Diff" {
9+
uses = "groupninemedia/filter-git-diff@master"
10+
args = "regex ^config"
11+
}
12+
```

bin/regex

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
EXIT_CODE=$(git diff --stat | grep -c -E "$@")
4+
5+
if [ $? -eq 0 ]; then
6+
git diff --stat | grep -E "$@"
7+
exit 0
8+
else
9+
echo "Regex found nothing"
10+
exit 78
11+
fi

entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
sh -c "$*"

0 commit comments

Comments
 (0)