Skip to content
Snippets Groups Projects
  • anarcat's avatar
    3c67572f
    Workaround missing git · 3c67572f
    anarcat authored
    git is not available in that silly image of theirs, so we have to make
    a separate build stage to actually list the changed files, store that
    in an artifact, and *then* be able to do the run only on those files.
    
    That is quite silly. Surely there must be a better way?
    Workaround missing git
    anarcat authored
    git is not available in that silly image of theirs, so we have to make
    a separate build stage to actually list the changed files, store that
    in an artifact, and *then* be able to do the run only on those files.
    
    That is quite silly. Surely there must be a better way?
.gitlab-ci.yml 995 B
image:
  name: markdownlint/markdownlint
  entrypoint: ["/bin/bash", "-c"]

find-files-commit:
  stage: build
  image: debian:stable-slim
  script:
    - echo "commit SHA $CI_COMMIT_SHA"
    - echo "working on files..."
    - git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA | tee changed-files.txt
  except: [merge_requests]
  artifacts:
    paths:
      - changed-files.txt
    expose_as: 'changed files'

find-files-mr:
  stage: build
  image: debian:stable-slim
  script:
    - echo "MR target SHA $CI_MERGE_REQUEST_TARGET_BRANCH_SHA"
    - echo "working on files..."
    - git diff-tree --no-commit-id --name-only -r $CI_MERGE_REQUEST_TARGET_BRANCH_SHA | tee changed-files.txt
  only: [merge_requests]
  artifacts:
    paths:
      - changed-files.txt
    expose_as: 'changed files'

test:
  script:
    - echo "working on files..."
    - cat changed-files.txt
    - ./bin/mdl-wrapper $(cat changed-files.txt)

testall:
  script:
    - echo $PWD
    - mdl .
  allow_failure: true