github.com/facebookincubator/ttpforge@v1.0.13-0.20240405153150-5ae801628835/example-ttps/actions/edit-file/append-delete.yaml (about)

     1  ---
     2  api_version: 2.0
     3  uuid: 5e539ad7-1f78-4301-8c73-2794915fc05f
     4  name: edit_file_append_delete
     5  description: |
     6    Learn how to append and delete lines
     7    with the edit_file action.
     8  args:
     9    - name: test_file_path
    10      type: path
    11      description: The path at which the temporary test file should be created
    12      default: /tmp/ttpforge_edit_file_append_delete
    13  steps:
    14    - name: create-tmp-file
    15      create_file: {{.Args.test_file_path}}
    16      contents: |
    17        this_will_be_deleted
    18        and also this_will_be_deleted
    19        this will survive
    20        // all of these
    21        // lines will be
    22        // deleted by a regexp
    23        and this will also survive
    24      overwrite: true
    25    - name: edit_test_file
    26      edit_file: {{.Args.test_file_path}}
    27      edits:
    28        - description: |
    29            Delete all occurrences of a string literal
    30          delete: this_will_be_deleted
    31        - description: You can also delete regular expressions matches
    32          delete: (?m://.*$)
    33          regexp: true
    34        - description: Append a line to the file
    35          append: this will be appended to the end of the file
    36    - name: display_result
    37      inline: cat {{.Args.test_file_path}}