Sanjay
Sanjay

Reputation: 1

Get only the pr form a git branch in concourse

- name: databricks-repo
  type: git
  icon: github-circle
  source:
  uri: xyz.git
  branch: master
  private_key: ((key))

I am trying to do a code scan only to the PR from the git branch. the above code gets me only the code from the branch not the pr

Upvotes: 0

Views: 321

Answers (1)

Use the Github PR Resource to accomplish this. This is the example they provide on the project page:


resource_types:
- name: pull-request
  type: docker-image
  source:
    repository: teliaoss/github-pr-resource

resources:
- name: pull-request
  type: pull-request
  check_every: 24h
  webhook_token: ((webhook-token))
  source:
    repository: itsdalmo/test-repository
    access_token: ((github-access-token))

jobs:
- name: test
  plan:
  - get: pull-request
    trigger: true
    version: every
  - put: pull-request
    params:
      path: pull-request
      status: pending
  - task: unit-test
    config:
      platform: linux
      image_resource:
        type: docker-image
        source: {repository: alpine/git, tag: "latest"}
      inputs:
        - name: pull-request
      run:
        path: /bin/sh
        args:
          - -xce
          - |
            cd pull-request
            git log --graph --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s" > log.txt
            cat log.txt
    on_failure:
      put: pull-request
      params:
        path: pull-request
        status: failure
  - put: pull-request
    params:
      path: pull-request
      status: success

Upvotes: -1

Related Questions