github.com/facebookincubator/ttpforge@v1.0.13-0.20240405153150-5ae801628835/docs/foundations/actions/create_file.md (about) 1 # TTPForge Actions: `create_file` 2 3 The `create_file` action can be used to drop files on disk without the need to 4 loudly invoke a shell and use `cat` or `echo`. Check out the TTP below to see 5 how it works: 6 7 https://github.com/facebookincubator/TTPForge/blob/7634dc65879ec43a108a4b2d44d7eb2105a2a4b1/example-ttps/actions/create-file/basic.yaml#L1-L22 8 9 You can experiment with the above TTP by installing the `examples` TTP 10 repository (skip this if `ttpforge list repos` shows that the `examples` repo is 11 already installed): 12 13 ```bash 14 ttpforge install repo https://github.com/facebookincubator/TTPForge --name examples 15 ``` 16 17 and then running the below command: 18 19 ```bash 20 ttpforge run examples//actions/create-file/basic.yaml 21 ``` 22 23 ## Fields 24 25 You can specify the following YAML fields for the `create_file:` action: 26 27 - `create_file:` (type: `string`) the path to the file you want to create. 28 - `contents:` (type: `string`) the contents that you want placed in the new 29 file. 30 - `overwrite:` (type: `bool`) whether the file should be overwritten if it 31 already exists. 32 - `mode:` the octal permission mode (`chmod` style) for the new file. 33 - `cleanup:` you can set this to `default` in order to automatically cleanup the 34 created file, or define a custom 35 [cleanup action](https://github.com/facebookincubator/TTPForge/blob/main/docs/foundations/cleanup.md#cleanup-basics).