I'm currently working on a project.
The project has a composer.json file (which is not local, I need to get the file from Bitbucket first) which keeps track of the versions of my Wordpress plugins. When an update is detected (which I use other plugins for to do so), it should replace the old version with the new version in the composer.json at the right plugin name, then make a commit.
How would you guys approach this?
Hello @Mert Polat,
I'd look at Bitbucket Pipelines to implement this so that no local machines are involved in the update process. You can trigger a custom pipeline when an update is detected, and that pipeline would perform necessary version replacements and push the updated file back to the repo.
You might also want to set up a scheduled pipeline to fully automate the process.
Hope this helps.
Cheers,
Daniil
The problem is that I must have the file locally, so I need to pull the composer.json first.
https://bitbucket.org/{name}/profile/projects/{projectname}
Thats where all our projects are located. Is there a way to get each composer file in each of those project folders?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Projects are essentially groups of repositories, and files reside in repositories. Most of operations are scoped to a repository, so you'll need to do something with each of the repositories in question.
You can use REST API to list files in a repository, get raw file content, and commit to a repository.
You might be able to make use of Code Search to find all composer files in the entire account (or limit it to some projects or repositories). However note that it has constraints, for instance indexed file size limit (if the file is too big, it won't be indexed and won't appear in search results).
If you must commit from a local machine and can't use the REST API, you'll need to clone the repositories in question. You can use shallow cloning to reduce the size of objects to clone for each repo.
Hope this answers your question.
Cheers,
Daniil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.