dependabot-script
dependabot-script copied to clipboard
How to set DIRECTORY_PATH
Hi! I can't set DIRECTORY_PATH
correctly.
Currently my .gitlab-ci.yml
looks like this
.dependabot:
image: dependabot/dependabot-core
variables:
PACKAGE_MANAGER: $CI_JOB_NAME
before_script:
- bundle install -j $(nproc) --path vendor
script: bundle exec ruby ./generic-update-script.rb
cache:
paths:
- vendor/
only:
- schedules
npm_and_yarn:
extends: .dependabot
only:
variables:
- $PACKAGE_MANAGER_SET =~ /(\bnpm|yarn\b)/
- $DIRECTORY_PATH =~ /Frontend/
The error is that it still tries to get files from the root of the repo that I'm trying to update dependencies. So no variable cant is not applied here.
Why I did $DIRECTORY_PATH =~ /Frontend/
?
Because if I do
-
- DIRECTORY_PATH =~ /Frontend/
-jobs:npm_and_yarn:only variables invalid expression syntax
-
- $DIRECTORY_PATH = /Frontend/
-jobs:npm_and_yarn:only variables invalid expression syntax
-
- $DIRECTORY_PATH = Frontend
-jobs:npm_and_yarn:only variables invalid expression syntax
-
- $DIRECTORY_PATH = "Frontend"
-jobs:npm_and_yarn:only variables invalid expression syntax
-
- $DIRECTORY_PATH: "Frontend"
- gitlab just gives 500 error -
- DIRECTORY_PATH: "Frontend"
- gitlab just gives 500 error
I've tried a lot of things, none worked. What is the correct way of setting DIRECTORY_PATH variable?
@vladyslavstartsev You have all the documentation online: https://docs.gitlab.com/ee/ci/yaml/README.html#variables
only: variables:
object is for restricting related jobs to when variables are set to the specified values.
variables:
is for defining variables.
npm_and_yarn:
extends: .dependabot
variables:
DIRECTORY_PATH: Frontend
only:
variables:
- $PACKAGE_MANAGER_SET =~ /(\bnpm|yarn\b)/
okay, this one works