Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for "get repository file" #2

Open
Herrner opened this issue Jun 10, 2020 · 2 comments
Open

Example for "get repository file" #2

Herrner opened this issue Jun 10, 2020 · 2 comments

Comments

@Herrner
Copy link

Herrner commented Jun 10, 2020

Can you provide an example of what a working config for "get repository file" would be? The "Full path to file" and "name of branch, tag or commit" are giving me a hard time - I haven't got anything but 404s out of it so far. To get to the README.rst in the root folder of the master branch of any given repository, what would msg.payload.file_path and msg.payload.ref be?

@VincentSC
Copy link

VincentSC commented Dec 15, 2021

This plugin depends on the node "gitlab", which does not support v4 api. It has also been moved to another project like 3 years ago. I'm trying to fix it.

edit: seemingly it does support v4, but not the version used.

@VincentSC
Copy link

VincentSC commented Dec 15, 2021

Ok, found a fix:

  • replace the plugin with https://github.com/FVLArchive/node-red-contrib-gitlab
    • remove the current one
    • run npm install FVLArchive/node-red-contrib-gitlab in node_modules
    • change the url from XXX/api/v4 to XXX, else you'll get a 404
  • put in the below data, but replace the gitlab-config with your own or edit this one.

As a bonus, the one made by FVLArchive is much cleaner code.

[{"id":"16d19ce4.a4bfab","type":"change","z":"8e99df1a.e08be8","name":"Get active projects","rules":[{"t":"set","p":"payload.project_id","pt":"msg","to":"291","tot":"num"},{"t":"set","p":"payload.file_path","pt":"msg","to":"active_groups.txt","tot":"str"},{"t":"set","p":"payload.ref","pt":"msg","to":"master","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":1820,"wires":[["8422cf6.1a0f2b"]]},{"id":"85102f16.5cf5d","type":"inject","z":"8e99df1a.e08be8","name":"","props":[{"p":"payload.action","v":"start","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":1820,"wires":[["16d19ce4.a4bfab"]]},{"id":"f65e4889.61e548","type":"base64","z":"8e99df1a.e08be8","name":"","action":"b64","property":"payload.content","x":740,"y":1820,"wires":[["12112d6a.511f3b"]]},{"id":"12112d6a.511f3b","type":"change","z":"8e99df1a.e08be8","name":"","rules":[{"t":"set","p":"payload.groups","pt":"msg","to":"$split(msg.payload.content,\"\\n\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":970,"y":1820,"wires":[["d655d6f8.bf254"]]},{"id":"d655d6f8.bf254","type":"debug","z":"8e99df1a.e08be8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1190,"y":1820,"wires":[]},{"id":"8422cf6.1a0f2b","type":"GitLab-Get-RepositoryFile","z":"8e99df1a.e08be8","name":"active_groups.txt","ref":"master","gitlabconfig":"552694e.fa7e46c","x":510,"y":1820,"wires":[["03fd923670f47274","f65e4889.61e548"]]},{"id":"03fd923670f47274","type":"debug","z":"8e99df1a.e08be8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":1720,"wires":[]},{"id":"552694e.fa7e46c","type":"gitlab-config","url":"https://XXX","project_id":"","name":"Gitlab"}]

(this code I use for defining the groups that are active)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants