diff --git a/.config/autodoc.js b/.config/autodoc.mjs similarity index 69% rename from .config/autodoc.js rename to .config/autodoc.mjs index d1fdca0..8c71007 100644 --- a/.config/autodoc.js +++ b/.config/autodoc.mjs @@ -1,6 +1,6 @@ -const YAML = require("yaml"); -const tablemark = require("tablemark"); -const fs = require("fs"); +import fs from "fs"; +import tablemark from "tablemark"; +import YAML from "yaml"; const file = fs.readFileSync("./action.yml", "utf8"); @@ -11,7 +11,7 @@ Object.keys(yml.inputs).forEach((input) => { table.push({ input, required: yml.inputs[input] && yml.inputs[input].required ? "yes" : "", - default: yml.inputs[input] && yml.inputs[input].default ? yml.inputs[input].default : "", + default: yml.inputs[input] && yml.inputs[input].default ? "`" + yml.inputs[input].default + "`" : "", description: yml.inputs[input] && yml.inputs[input].description ? yml.inputs[input].description : "", }); }); diff --git a/.config/commit-docs.sh b/.config/commit-docs.sh index 7c39f24..03dab32 100755 --- a/.config/commit-docs.sh +++ b/.config/commit-docs.sh @@ -1,3 +1,4 @@ +# Copied from commit-build.sh # This script is used for repos that need to commit a build folder (eg. Github actions) # Add more sources/destinations by separating them by spaces (ie. source="src lib") @@ -11,7 +12,7 @@ then # Run build command echo "Generating $build..." - node .config/autodoc.js + node .config/autodoc.mjs # If this generated unstaged changes in $build folder(s) if [[ $(git status --porcelain $build | egrep '^(([M ]M)|\?\?)') ]] diff --git a/action.yml b/action.yml index 6c2e5a2..0cbf882 100644 --- a/action.yml +++ b/action.yml @@ -70,7 +70,7 @@ inputs: default: "" committer: - description: "Who will commit changes." + description: "Who will commit changes (author will be original committer)." required: false default: Github Actions diff --git a/docs/basic-usage.md b/docs/basic-usage.md index 71089b5..7316098 100644 --- a/docs/basic-usage.md +++ b/docs/basic-usage.md @@ -8,7 +8,8 @@ Once they are merged on SoT, Copybara will automatically push the code to the de - **Source of Truth (SoT) repo** - **Destination repo** -- **[SSH private key](ssh-keys.md)** with write access to destination repo (used to push code) +- **[SSH private key](ssh-keys.md)** with write access to both repos (used to + push code on destination and create/commit to branches on SoT) - **[GitHub Personal access token](https://github.com/settings/tokens)** with 'repo' permissions (used for determining default branches and managing pull requests on both repos) ## Examples diff --git a/docs/inputs.md b/docs/inputs.md index c8e97ae..295aaf4 100644 --- a/docs/inputs.md +++ b/docs/inputs.md @@ -1,25 +1,25 @@ -| Input | Required | Default | Description | -| ------------------ | -------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| ssh_key | yes | | SSH public key. | -| access_token | | | Personal access token with `repo` permissions. Always required on *destination*. Required on *SoT* only if the variable `sot_branch` below is left empty and to decide between **push** and **init** workflows. | -| sot_repo | | | Source repository (Source of Truth). | -| sot_branch | | | SoT branch. Defaults to your repository's default branch. | -| destination_repo | | | Destination repository. | -| destination_branch | | | Destination branch. Defaults to the same as your SoT's branch name. | -| push_include | | ** | Files to include when pushing from SoT => Destination (space separated globs). Defaults to all files. | -| push_exclude | | | Files to exclude when pushing from SoT => Destination (space separated globs). Defaults to none. | -| push_move | | | Files to move before pushing from SoT => Destination. In the format `from\|\|to\|\|match` where `match` is a glob filter to match only specific files within `from` (defaults to all). Separate each move operation by a line return. Defaults to reverse of `pr_move`. `push_move` is always run before `push_replace`. | -| push_replace | | | Files to replace before pushing from SoT => Destination. In the format `search\|\|replace\|\|match` where `match` is a glob filter to search only those files (defaults to all). Separate each replace operation by a line return. Defaults to reverse of `pr_replace`. `push_replace` is always run after `push_move`. | -| pr_include | | ** | Files to include when pulling from Destination => SoT (space separated globs). Defaults to all files. | -| pr_exclude | | | Files to exclude when pulling from Destination => SoT (space separated globs). Defaults to none. | -| pr_move | | | Files to move before pushing from Destination => SoT. In the format `from\|\|to\|\|match` where `match` is a glob filter to match only specific files within `from` (defaults to all). Separate each move operation by a line return. Defaults to none. `pr_move` is always run after `pr_replace`. | -| pr_replace | | | Files to replace before pushing from Destination => SoT. In the format `search\|\|replace\|\|match` where `match` is a glob filter to search only those files (defaults to all). Separate each replace operation by a line return. Defaults to none. `pr_replace` is always run before `pr_move`. | -| committer | | Github Actions | Who will commit changes. | -| custom_config | | | Copybara custom configuration file to use. Using this will ignore all the pr_* and push_* inputs. | -| workflow | | | Workflow to execute. Defaults to auto-detect (init / push / pr). | -| copybara_options | | | Use this, if you want to manually specify some command line options (space-separated). | -| ssh_known_hosts | | | SSH known hosts file contents, for authenticating with Copybara with another Git server. GitHub is always included by default. | -| copybara_image | | olivr/copybara | Copybara Docker image to run. | -| copybara_image_tag | | latest | Copybara Docker image tag to use. | -| pr_number | | | If you manually specified the 'pr' workflow, you will need to specify the PR number as well. | -| create_repo | | yes | If the destination repo doesn't exist, it will be created (subject to enough permissions attached to the access token). | +| Input | Required | Default | Description | +| :----------------- | :------- | :------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ssh_key | yes | | SSH public key. | +| access_token | | | Personal access token with `repo` permissions. Always required on *destination*. Required on *SoT* only if the variable `sot_branch` below is left empty and to decide between **push** and **init** workflows. | +| sot_repo | | | Source repository (Source of Truth). | +| sot_branch | | | SoT branch. Defaults to your repository's default branch. | +| destination_repo | | | Destination repository. | +| destination_branch | | | Destination branch. Defaults to the same as your SoT's branch name. | +| push_include | | `**` | Files to include when pushing from SoT => Destination (space separated globs). Defaults to all files. | +| push_exclude | | | Files to exclude when pushing from SoT => Destination (space separated globs). Defaults to none. | +| push_move | | | Files to move before pushing from SoT => Destination. In the format `from\|\|to\|\|match` where `match` is a glob filter to match only specific files within `from` (defaults to all). Separate each move operation by a line return. Defaults to reverse of `pr_move`. `push_move` is always run before `push_replace`. | +| push_replace | | | Files to replace before pushing from SoT => Destination. In the format `search\|\|replace\|\|match` where `match` is a glob filter to search only those files (defaults to all). Separate each replace operation by a line return. Defaults to reverse of `pr_replace`. `push_replace` is always run after `push_move`. | +| pr_include | | `**` | Files to include when pulling from Destination => SoT (space separated globs). Defaults to all files. | +| pr_exclude | | | Files to exclude when pulling from Destination => SoT (space separated globs). Defaults to none. | +| pr_move | | | Files to move before pushing from Destination => SoT. In the format `from\|\|to\|\|match` where `match` is a glob filter to match only specific files within `from` (defaults to all). Separate each move operation by a line return. Defaults to none. `pr_move` is always run after `pr_replace`. | +| pr_replace | | | Files to replace before pushing from Destination => SoT. In the format `search\|\|replace\|\|match` where `match` is a glob filter to search only those files (defaults to all). Separate each replace operation by a line return. Defaults to none. `pr_replace` is always run before `pr_move`. | +| committer | | `Github Actions ` | Who will commit changes (author will be original committer). | +| custom_config | | | Copybara custom configuration file to use. Using this will ignore all the pr_* and push_* inputs. | +| workflow | | | Workflow to execute. Defaults to auto-detect (init / push / pr). | +| copybara_options | | | Use this, if you want to manually specify some command line options (space-separated). | +| ssh_known_hosts | | | SSH known hosts file contents, for authenticating with Copybara with another Git server. GitHub is always included by default. | +| copybara_image | | `olivr/copybara` | Copybara Docker image to run. | +| copybara_image_tag | | `latest` | Copybara Docker image tag to use. | +| pr_number | | | If you manually specified the 'pr' workflow, you will need to specify the PR number as well. | +| create_repo | | `yes` | If the destination repo doesn't exist, it will be created (subject to enough permissions attached to the access token). |