def METHOD_NAME(ctx):
    # Directory that will contain all grouped input files. This directory will be created
    # relatively to the current target package. (e.g. "bin/src/components-examples/docs-content")
    output_dir = ctx.attr.name
    # Arguments that will be passed to the packager executable.
    args = ctx.actions.args()
    # List of outputs that should be generated by the packager action. Bazel will automatically
    # throw an error if any output has not been generated properly.
    expected_outputs = []
    # Support passing arguments through a parameter file. This is necessary because on Windows
    # there is an argument limit and we need to handle a large amount of input files. Bazel
    # switches between parameter file and normal argument passing based on the operating system.
    # Read more here: https://docs.bazel.build/versions/master/skylark/lib/Args.html#use_param_file
    args.use_param_file(param_file_arg = "--param-file=%s", use_always = True)
    # Walk through each defined input target and the associated section and compute the
    # output file which will be added to the executable arguments.
    for input_target, section_name in ctx.attr.srcs.items():
        section_files = input_target.files.to_list()
        base_dir = "%s" % (input_target.label.package)
        for input_file in section_files:
            # Creates a relative path from the input file. We don't want to include the full
            # path in docs content. e.g. `docs-content/overviews/cdk/src/cdk/a11y/a11y.html`.
            # Instead, we want the path to be: `docs-content/overviews/cdk/a11y/a11y.html`.
            section_relative_file_name = input_file.short_path[len(base_dir):]
            # For each input file, we want to create a copy that is stored in the output directory
            # within its specified section. e.g. "pkg_bin/docs-content/guides/getting-started.html"
            output_file = ctx.actions.declare_file(
                "%s/%s/%s" % (output_dir, section_name, section_relative_file_name),
            )
            # Add the output file to the expected outputs so that Bazel throws an error if the file
            # hasn't been generated properly.
            expected_outputs.append(output_file)
            # Pass the input file path and the output file path to the packager executable. We need
            # to do this for each file because we cannot determine the general path to the output
            # directory in a reliable way because Bazel targets cannot just "declare" a directory.
            # See: https://docs.bazel.build/versions/master/skylark/lib/actions.html
            args.add("%s,%s" % (input_file.path, output_file.path))
    # Do nothing if there are no input files. Bazel will throw if we schedule an action
    # that returns no outputs.
    if not ctx.files.srcs:
        return None
    # Run the packager executable that groups the specified source files and writes them
    # to the given output directory.
    ctx.actions.run(
        inputs = ctx.files.srcs,
        executable = ctx.executable._packager,
        outputs = expected_outputs,
        arguments = [args],
        progress_message = "PackageDocsContent",
    )
    return DefaultInfo(files = depset(expected_outputs))