Browse Source

travis: Only run gftools qa on prs which contain fonts

Marc Foley 5 years ago
parent
commit
e78091f898
2 changed files with 14 additions and 2 deletions
  1. 12 0
      .ci/run.sh
  2. 2 2
      .travis.yml

+ 12 - 0
.ci/run.sh

@@ -0,0 +1,12 @@
+# Only run gftools qa on prs which contain font files.
+
+PR_FILES=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST/files
+HAS_FONTS=$(curl -H "Authorization: token $GH_TOKEN" $PR_FILES | jq '[.[] | .filename | test("ttf|otf")] | any')
+
+if [ "$HAS_FONTS" = true ];
+then
+    echo "Running gftools qa"
+    gftools qa -pr https://github.com/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST -gfb -a -o qa -ogh
+else
+    echo "Skipping. No fonts in PR"
+fi

+ 2 - 2
.travis.yml

@@ -19,8 +19,8 @@ before_install:
   - cd ../..
   - cd ../..
 
 
 install:
 install:
-  - pip install git+https://github.com/googlefonts/gftools
+  - pip install gftools[qa]
 
 
 script:
 script:
-  - gftools qa -pr https://github.com/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST -gfb -a -o qa -ogh
+  - bash .ci/run.sh