reactjsgitlabgitlab-cigitlab-ci-runnercicd

why gitlab ci-cd does not change the file?


I created a Gitlab Ci-CD to remove react and react-dom from devDependencies in package.json when i push my code to master.

but as you can see it says that pipline is passed and job is succeeded but when i look at my master branch react and react-dom are not removed from devDependencies and they are still there. what should i do with that? enter image description here


Solution

  • A GitLab CI job doesn't change any of your repository files. It pulls a copy of the repository so that it can run a script, test, etc. against it. If the specified job runs successfully without throwing any errors (exit code), then the job succeeds/passes. You can find a more detailed explanation in the GitLab CI/CD documentation.

    If you want to make changes to the repository, you need to have the script run to make the changes, then commit the changes, and push those changes to the repository using the standard git commands.

    Just remember that you'll have to authenticate using HTTPS or using SSH.

    You'll also likely find this StackOverflow answer on pushing to a GitLab repository through a CI job helpful as well.