Craft your forge // Build your project // Grow your community freely
1<!--
2SPDX-FileCopyrightText: 2025 Romain Maneschi <romain@gitroot.dev>
3 4SPDX-License-Identifier: CC-BY-SA-4.0
5--> 6 7# Plugin rights
8 9Plugins are the true power of GitRoot. But, as you know, with power comes responsability. To be sure to understand what a plugin can and can't, GitRoot expose all details in `.gitroot/plugins.yml`.
1011## First example
1213Taking [ladybug](../../plugins/name/ladybug.md) as an example:
1415```yml
16- purl: pkg:gitroot/gitroot/ladybug@0.0.5?checksum=sha256:7409837469ce89d5c9fd8dd48236764650f4852®istry=https:%2F%2F%2Fgitroot.dev%2Freleases%2F0.5.0
17active: true18run:
19 - path: issues/**/*.md
20branch:
21 - "*"22when:
23 - add
24 - mod
25write:
26git:
27 - path: issues/**/*.md
28can:
29 - mod
30web: []
31configuration: ...
32```3334You can read: "for all branches in your repository, when you modify or create any markdown file in the directory or a sud-directory of issues execute the plugin. During execution it can write in any markdown file in the directory or a sud-directory of issues in modification."
3536But it can't create a file in git or write in web.
3738Be carrefull, the plugin will be called for modification of `issues/1.md`, but it can modify `issues/2.md` if it need to do.
3940_Configuration has been omitted because it depend on each plugin._4142## More complexe example
4344If you look at the [plugins.yml](../../.gitroot/plugins.yml) of GitRoot itself you will see that [apex plugin](../../plugins/name/apex.md) have a more complexe configuration:
4546```yml
47- purl: pkg:gitroot/gitroot/apex@0.0.5?checksum=sha256:97fa5fd2b49f7c9d0b9b6b®istry=https:%2F%2F%2Fgitroot.dev%2Freleases%2F0.5.0
48active: true49run:
50 - path: "**/*"51branch:
52 - main
53when:
54 - add
55 - mod
56 - del
57write:
58git:
59 - path: index.md
60can:
61 - add
62web:
63 - path: "**/*"64can:
65 - add
66 - mod
67 - del
68 - append
69configuration: &apexConf70header: ...
71 - path: "**/*"72branch:
73 - "*"74 - "!main"75when:
76 - add
77 - mod
78 - del
79write:
80git: []
81web:
82 - path: branches/**/*
83can:
84 - add
85 - mod
86 - del
87 - append
88configuration:
89<<: *apexConf90generateGitWorktree: false91```9293You can read it as: "On the main branch, every file can be rendered in the web. An `index.md` can be created in the git worktree. But for all other branches, apex plugin can only write in the `branches` directory".
9495Why? Because in GitRoot everybody can create a branch. Imagine if a bad person come, create a branch and delete all the content of the repository. Then push it, if apex render that in the web, your repository website will be empty... What we want is: render modif in an other url (e.g. http://myTld.com/myRepo/branches/brach-test/myFile) and when the change are commited to the default branche render in final destination (e.g. http://myTld.com/myRepo/myFile).