How to conditionally run an empty build?


#1

Due to the bug in Travis that prevents my branches from being triggered in the “Trigger Build” modal unless they’ve already been run via pushing on that branch (link), I would like to have Travis kick off a job when a branch is pushed that just runs the following script:
echo "Please ignore this build! It's a workaround for a Travis bug."

Here is my .travis.yml file:

if: type = cron OR type = api
dist: trusty
language: ruby
rvm: 2.4.1
services: docker
cache: bundler
bundler_args: --without development
before_install:
  - gem update --system
  - gem --version
after_script: docker-compose down
env:
  global: QA_WEB_HOST="stage"

matrix:
  include:
  - name: "Patient Portal: Billing Information"
    env: APP_NAME=patient_portal
    script: bundle exec rspec spec/features/tests/md_patient_portal/md_patient_billing_check_spec.rb
    # numerous other jobs
    # ...
if: NOT (type = cron OR type = api)
matrix:
  include:
    script: echo "Please ignore this build, it's a workaround for a Travis bug"

Although in the second conditional the large build matrix has been overwritten with a single job that does an echo, the Travis worker is still doing ruby/bundling/docker setup. What values should I assign to these keys so it doesn’t execute those steps? Or how can I unset all of those and just pass the Travis worker an empty hash when it parses the YAML block from the second conditional, is there some indentation trick I could use?