This is an automated email from the ASF dual-hosted git repository.
urfree pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git
The following commit(s) were added to refs/heads/main by this push:
new 233c55b update
233c55b is described below
commit 233c55b2892de00055f76621542d879c4a04f510
Author: LiLi <[email protected]>
AuthorDate: Wed Jan 26 17:10:09 2022 +0800
update
Signed-off-by: LiLi <[email protected]>
---
.github/actions/changed-files/action.yml | 2 +-
.github/actions/glob/action.yml | 61 ++++++++++++++++++++++++++++++++
.github/actions/glob/main.js | 37 +++++++++++++++++++
3 files changed, 99 insertions(+), 1 deletion(-)
diff --git a/.github/actions/changed-files/action.yml
b/.github/actions/changed-files/action.yml
index 1605355..5c2383b 100644
--- a/.github/actions/changed-files/action.yml
+++ b/.github/actions/changed-files/action.yml
@@ -122,7 +122,7 @@ runs:
INPUT_FILES: ${{ inputs.files }}
INPUT_FILES_FROM_SOURCE_FILE: ${{ inputs.files_from_source_file }}
- name: Glob match
- uses: tj-actions/[email protected]
+ uses: ../glob
id: glob
with:
files: ${{ steps.source-input-files.outputs.files }}
diff --git a/.github/actions/glob/action.yml b/.github/actions/glob/action.yml
new file mode 100644
index 0000000..a909952
--- /dev/null
+++ b/.github/actions/glob/action.yml
@@ -0,0 +1,61 @@
+name: Glob match
+description: Search for files matching glob patterns.
+author: tj-actions
+inputs:
+ token:
+ description: The GitHub token used to create an authenticated client
+ default: ${{ github.token }}
+ required: false
+ files:
+ description: 'File patterns'
+ required: true
+ files-separator:
+ description: 'Separator used to split the files input'
+ default: "\\n"
+ required: false
+ follow-symbolic-links:
+ description: 'Indicates whether to follow symbolic links'
+ default: "true"
+ required: false
+ separator:
+ description: 'Separator used for the paths output.'
+ required: false
+ default: " "
+ strip-top-level-dir:
+ description: 'Strip the `$GITHUB_WORKSPACE` from the paths output'
+ required: false
+ default: "true"
+
+outputs:
+ paths:
+ description: "List of filtered paths using the specified patterns and
separator"
+ value: ${{ steps.glob.outputs.paths }}
+
+runs:
+ using: 'composite'
+ steps:
+ - name: Get matching files
+ uses: actions/github-script@v5
+ id: glob
+ with:
+ github-token: ${{ inputs.token }}
+ script: |
+ const path = require("path");
+
+ const { GITHUB_ACTION_PATH } = process.env
+ const ACTION_PATH = path.join(GITHUB_ACTION_PATH, "main.js")
+
+ const main = require(ACTION_PATH)
+ await main({ core, glob })
+ env:
+ GITHUB_ACTION_PATH: ${{ github.action_path }}
+ GITHUB_WORKSPACE: ${{ github.workspace }}
+ INPUT_FILES: ${{ inputs.files }}
+ INPUT_FILES_SEPARATOR: ${{ inputs.files-separator }}
+ INPUT_FOLLOW_SYMBOLIC_LINKS: ${{ inputs.follow-symbolic-links }}
+ INPUT_SEPARATOR: ${{ inputs.separator }}
+ INPUT_STRIP_TOP_LEVEL_DIR: ${{ inputs.strip-top-level-dir }}
+
+branding:
+ icon: filter
+ color: white
\ No newline at end of file
diff --git a/.github/actions/glob/main.js b/.github/actions/glob/main.js
new file mode 100644
index 0000000..0599280
--- /dev/null
+++ b/.github/actions/glob/main.js
@@ -0,0 +1,37 @@
+const path = require("path");
+
+const {
+ GITHUB_WORKSPACE,
+ INPUT_FILES,
+ INPUT_FILES_SEPARATOR,
+ INPUT_FOLLOW_SYMBOLIC_LINKS,
+ INPUT_SEPARATOR,
+ INPUT_STRIP_TOP_LEVEL_DIR,
+} = process.env;
+
+const githubWorkspace = GITHUB_WORKSPACE || process.cwd();
+const topLevelDir = `${githubWorkspace}${path.sep}`;
+
+module.exports = async ({ core, glob }) => {
+ let files;
+
+ if (INPUT_FILES_SEPARATOR === "\\n") {
+ files = INPUT_FILES;
+ } else {
+ files = INPUT_FILES.split(INPUT_FILES_SEPARATOR).join("\n");
+ }
+
+ const globOptions = {
+ followSymbolicLinks: INPUT_FOLLOW_SYMBOLIC_LINKS === "true",
+ };
+ const globber = await glob.create(files, globOptions);
+ let paths = await globber.glob();
+
+ if (INPUT_STRIP_TOP_LEVEL_DIR === "true") {
+ paths = paths
+ .map((p) => p.replace(topLevelDir, ""))
+ .filter((p) => p !== "");
+ }
+
+ core.setOutput("paths", paths.join(INPUT_SEPARATOR));
+};