

import os

import requests
import six

import conda_smithy.ci_register


def rebuild_travis(repo_slug):
    headers = conda_smithy.ci_register.travis_headers()

    # If we don't specify the API version, we get a 404.
    # Also fix the accepted content type.
    headers["Accept"] = "application/json"
    headers["Travis-API-Version"] = "3"

    # Trigger a build on `master`.
    encoded_slug = six.moves.urllib.parse.quote(repo_slug, safe='')
    url = 'https://api.travis-ci.org/repo/{}/requests'.format(encoded_slug)
    response = requests.post(
        url,
        json={"request": {"branch": "master"}},
        headers=headers
    )
    if response.status_code != 201:
        response.raise_for_status()


if __name__ == '__main__':
    rebuild_travis('conda-forge/conda-forge.github.io')



import os

import requests
import six

import conda_smithy.ci_register


def rebuild_travis(repo_slug):
    headers = conda_smithy.ci_register.travis_headers()

    # If we don't specify the API version, we get a 404.
    # Also fix the accepted content type.
    headers["Accept"] = "application/json"
    headers["Travis-API-Version"] = "3"

    # Trigger a build on `master`.
    encoded_slug = six.moves.urllib.parse.quote(repo_slug, safe='')
    url = 'https://api.travis-ci.org/repo/{}/requests'.format(encoded_slug)
    response = requests.post(
        url,
        json={
            "request": {
                "branch": "master",
                "message": "Triggering build from staged-recipes",
            }
        },
        headers=headers
    )
    if response.status_code != 201:
        response.raise_for_status()


if __name__ == '__main__':
    rebuild_travis('conda-forge/conda-forge.github.io')

Add message to webpage repo trigger
Add message to webpage repo trigger

Should fix triggering builds on the webpage repo even when the most
recent commit message skip the CI build. Also should make it easier to
identify builds started by this trigger.

[ci skip]
[skip ci]

  
  
  import os
  
  import requests
  import six
  
  import conda_smithy.ci_register
  
  
  def rebuild_travis(repo_slug):
      headers = conda_smithy.ci_register.travis_headers()
  
      # If we don't specify the API version, we get a 404.
      # Also fix the accepted content type.
      headers["Accept"] = "application/json"
      headers["Travis-API-Version"] = "3"
  
      # Trigger a build on `master`.
      encoded_slug = six.moves.urllib.parse.quote(repo_slug, safe='')
      url = 'https://api.travis-ci.org/repo/{}/requests'.format(encoded_slug)
      response = requests.post(
          url,
-         json={"request": {"branch": "master"}},
+         json={
+             "request": {
+                 "branch": "master",
+                 "message": "Triggering build from staged-recipes",
+             }
+         },
          headers=headers
      )
      if response.status_code != 201:
          response.raise_for_status()
  
  
  if __name__ == '__main__':
      rebuild_travis('conda-forge/conda-forge.github.io')
  
Add message to webpage repo trigger
## Code Before:


import os

import requests
import six

import conda_smithy.ci_register


def rebuild_travis(repo_slug):
    headers = conda_smithy.ci_register.travis_headers()

    # If we don't specify the API version, we get a 404.
    # Also fix the accepted content type.
    headers["Accept"] = "application/json"
    headers["Travis-API-Version"] = "3"

    # Trigger a build on `master`.
    encoded_slug = six.moves.urllib.parse.quote(repo_slug, safe='')
    url = 'https://api.travis-ci.org/repo/{}/requests'.format(encoded_slug)
    response = requests.post(
        url,
        json={"request": {"branch": "master"}},
        headers=headers
    )
    if response.status_code != 201:
        response.raise_for_status()


if __name__ == '__main__':
    rebuild_travis('conda-forge/conda-forge.github.io')

## Instruction:
Add message to webpage repo trigger
## Code After:


import os

import requests
import six

import conda_smithy.ci_register


def rebuild_travis(repo_slug):
    headers = conda_smithy.ci_register.travis_headers()

    # If we don't specify the API version, we get a 404.
    # Also fix the accepted content type.
    headers["Accept"] = "application/json"
    headers["Travis-API-Version"] = "3"

    # Trigger a build on `master`.
    encoded_slug = six.moves.urllib.parse.quote(repo_slug, safe='')
    url = 'https://api.travis-ci.org/repo/{}/requests'.format(encoded_slug)
    response = requests.post(
        url,
        json={
            "request": {
                "branch": "master",
                "message": "Triggering build from staged-recipes",
            }
        },
        headers=headers
    )
    if response.status_code != 201:
        response.raise_for_status()


if __name__ == '__main__':
    rebuild_travis('conda-forge/conda-forge.github.io')
