forked from javaparser/javaparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixup.sh
executable file
·42 lines (34 loc) · 1019 Bytes
/
fixup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
./mvnw org.walkmod.maven.plugins:walkmod-maven-plugin:apply -Dchains=pmd -Dproperties="configurationFile=ruleset.xml" -Dpath=src/main/java
git diff > walkmod.patch
if [ "$TRAVIS_PULL_REQUEST" = false ] ; then
echo 'Skipped build. This is not a pull request'
exit 0
fi
if [ -z "$TRAVIS_REPO_SLUG" ]
then
echo "There is not TRAVIS_REPO_SLUG defined"
exit 1
fi
if [ -z "$TRAVIS_PULL_REQUEST_SHA" ]
then
echo "There is not TRAVIS_PULL_REQUEST_SHA defined"
exit 1
fi
if [ -z "$OCTOPATCH_API_TOKEN" ] ; then
echo "There is not OCTOPATCH_API_TOKEN defined"
exit 1
fi
REQUEST="curl -X POST -H \"Content-Type: multipart/form-data\""
FILES=$(find . -type f -name "*.patch")
if [ -z "$FILES" ]
then
echo "Perfect! There are not patch files"
exit 0
fi
for FILE in $FILES
do
REQUEST+=" -F \"data=@$FILE\""
done
REQUEST+=" -H \"Authorization: $OCTOPATCH_API_TOKEN\" api.octopatch.io/api/pulls/$TRAVIS_REPO_SLUG/$TRAVIS_PULL_REQUEST/$TRAVIS_PULL_REQUEST_SHA"
eval $REQUEST