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 697341b update
697341b is described below
commit 697341b56498cd2f760761cc2c6a14197d938ea1
Author: LiLi <[email protected]>
AuthorDate: Wed Jan 26 17:05:45 2022 +0800
update
Signed-off-by: LiLi <[email protected]>
---
.github/actions/changed-files/action.yml | 150 ++++++++++++
.github/actions/changed-files/entrypoint.sh | 253 +++++++++++++++++++++
.github/actions/changed-files/sourcefiles.sh | 30 +++
.../workflows/ci-pulsar-website-next-build.yaml | 33 ++-
4 files changed, 449 insertions(+), 17 deletions(-)
diff --git a/.github/actions/changed-files/action.yml
b/.github/actions/changed-files/action.yml
new file mode 100644
index 0000000..1605355
--- /dev/null
+++ b/.github/actions/changed-files/action.yml
@@ -0,0 +1,150 @@
+name: Changed files
+description: Get all changed files for push and pull request events.
+author: tj-actions
+
+inputs:
+ token:
+ description: 'Github token'
+ required: true
+ default: ${{ github.token }}
+ separator:
+ description: 'Split character for array output'
+ required: true
+ default: " "
+ files_from_source_file:
+ description: 'Source file to populate the files input'
+ required: false
+ default: ""
+ files:
+ description: 'Check for changes using only this list of files (Defaults to
the entire repo)'
+ required: false
+ default: ""
+ sha:
+ description: 'Specify a current commit SHA used for comparing changes'
+ required: true
+ default: ${{ github.sha }}
+ base_sha:
+ description: 'Specify a base commit SHA on used for comparing changes'
+ required: false
+ since_last_remote_commit:
+ description: 'Use the last commit on the remote branch as the base_sha for
push event.'
+ required: false
+ default: 'false'
+ path:
+ description: 'Specify a relative path under $GITHUB_WORKSPACE to locate
the repository'
+ required: false
+
+outputs:
+ added_files:
+ description: List of added files.
+ value: ${{ steps.changed-files.outputs.added_files }}
+ copied_files:
+ description: List of copied files.
+ value: ${{ steps.changed-files.outputs.copied_files }}
+ deleted_files:
+ description: List of deleted files.
+ value: ${{ steps.changed-files.outputs.deleted_files }}
+ modified_files:
+ description: List of modified files.
+ value: ${{ steps.changed-files.outputs.modified_files }}
+ renamed_files:
+ description: List of renamed files.
+ value: ${{ steps.changed-files.outputs.renamed_files }}
+ type_changed_files:
+ description: List of files that had type changes.
+ value: ${{ steps.changed-files.outputs.type_changed_files }}
+ unmerged_files:
+ description: List of unmerged files.
+ value: ${{ steps.changed-files.outputs.unmerged_files }}
+ unknown_files:
+ description: List of unknown files.
+ value: ${{ steps.changed-files.outputs.unknown_files }}
+ all_changed_and_modified_files:
+ description: List of all changed files.
+ value: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
+ all_changed_files:
+ description: List of all copied, modified, and added files.
+ value: ${{ steps.changed-files.outputs.all_changed_files }}
+ any_changed:
+ description: Return true only when any files provided using the files
input have changed.
+ value: ${{ steps.changed-files.outputs.any_changed }}
+ only_changed:
+ description: Return true when all files provided using the files input
have changed.
+ value: ${{ steps.changed-files.outputs.only_changed }}
+ other_changed_files:
+ description: Return list of changed files not listed in the files input.
+ value: ${{ steps.changed-files.outputs.other_changed_files }}
+ all_modified_files:
+ description: List of all copied, modified, added and deleted files.
+ value: ${{ steps.changed-files.outputs.all_modified_files }}
+ any_modified:
+ description: Return true only when any files provided using the files
input have been modified.
+ value: ${{ steps.changed-files.outputs.any_modified }}
+ only_modified:
+ description: Return true when all files provided using the files input
have been modified.
+ value: ${{ steps.changed-files.outputs.only_modified }}
+ other_modified_files:
+ description: Return list of modified files not listed in the files input.
+ value: ${{ steps.changed-files.outputs.other_modified_files }}
+ any_deleted:
+ description: Return true only when any files provided using the files
input have been deleted.
+ value: ${{ steps.changed-files.outputs.any_deleted }}
+ only_deleted:
+ description: Return true when all files provided using the files input
have been deleted.
+ value: ${{ steps.changed-files.outputs.only_deleted }}
+ other_deleted_files:
+ description: Return list of deleted files not listed in the files input.
+ value: ${{ steps.changed-files.outputs.other_deleted_files }}
+
+runs:
+ using: 'composite'
+ steps:
+ - run: |
+ # "Set base sha..."
+ if [[ -n "${{ inputs.base_sha }}" ]]; then
+ echo "::set-output name=base_sha::${{ inputs.base_sha }}"
+ elif [[ "${{ inputs.since_last_remote_commit }}" == "true" ]]; then
+ if [[ "${{ github.event.before }}" !=
"0000000000000000000000000000000000000000" ]]; then
+ echo "::set-output name=base_sha::${{ github.event.before }}"
+ else
+ echo "::set-output name=base_sha::${{ github.sha }}"
+ fi
+ fi
+ id: base-sha
+ shell: bash
+ - run: |
+ bash $GITHUB_ACTION_PATH/sourcefiles.sh
+ id: source-input-files
+ shell: bash
+ env:
+ # INPUT_<VARIABLE_NAME> is not available in Composite run steps
+ #
https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
+ INPUT_FILES: ${{ inputs.files }}
+ INPUT_FILES_FROM_SOURCE_FILE: ${{ inputs.files_from_source_file }}
+ - name: Glob match
+ uses: tj-actions/[email protected]
+ id: glob
+ with:
+ files: ${{ steps.source-input-files.outputs.files }}
+ files-separator: " "
+ separator: "|"
+ - run: |
+ bash $GITHUB_ACTION_PATH/entrypoint.sh
+ id: changed-files
+ shell: bash
+ env:
+ GITHUB_SERVER_URL: ${{ github.server_url }}
+ GITHUB_REPOSITORY: ${{ github.repository }}
+ GITHUB_BASE_REF: ${{ github.base_ref }}
+ # INPUT_<VARIABLE_NAME> is not available in Composite run steps
+ #
https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
+ INPUT_SHA: ${{ inputs.sha }}
+ INPUT_BASE_SHA: ${{ steps.base-sha.outputs.base_sha }}
+ INPUT_TOKEN: ${{ inputs.token }}
+ INPUT_FILES_PATTERN: ${{ steps.glob.outputs.paths }}
+ INPUT_SEPARATOR: ${{ inputs.separator }}
+ INPUT_PATH: ${{ inputs.path }}
+
+branding:
+ icon: file-text
+ color: white
diff --git a/.github/actions/changed-files/entrypoint.sh
b/.github/actions/changed-files/entrypoint.sh
new file mode 100755
index 0000000..dcd6fe7
--- /dev/null
+++ b/.github/actions/changed-files/entrypoint.sh
@@ -0,0 +1,253 @@
+#!/usr/bin/env bash
+
+set -eu
+
+echo "::group::changed-files"
+
+echo "Resolving repository path..."
+
+if [[ -n $INPUT_PATH ]]; then
+ REPO_DIR="$GITHUB_WORKSPACE/$INPUT_PATH"
+ if [[ ! -d "$REPO_DIR" ]]; then
+ echo "::warning::Invalid repository path"
+ exit 1
+ fi
+ cd "$REPO_DIR"
+fi
+
+SERVER_URL=$(echo "$GITHUB_SERVER_URL" | awk -F/ '{print $3}')
+
+echo "Setting up 'temp_changed_files' remote..."
+
+git ls-remote --exit-code temp_changed_files 1>/dev/null 2>&1 &&
exit_status=$? || exit_status=$?
+
+if [[ $exit_status -ne 0 ]]; then
+ echo "No 'temp_changed_files' remote found"
+ echo "Creating 'temp_changed_files' remote..."
+ git remote remove temp_changed_files 2>/dev/null || true
+ git remote add temp_changed_files
"https://${INPUT_TOKEN}@${SERVER_URL}/${GITHUB_REPOSITORY}"
+else
+ echo "Found 'temp_changed_files' remote"
+fi
+
+echo "Getting HEAD info..."
+
+if [[ -z $INPUT_SHA ]]; then
+ CURRENT_SHA=$(git rev-parse HEAD 2>&1) && exit_status=$? || exit_status=$?
+else
+ CURRENT_SHA=$INPUT_SHA && exit_status=$? || exit_status=$?
+fi
+
+git rev-parse --quiet --verify "$CURRENT_SHA^{commit}" 1>/dev/null 2>&1 &&
exit_status=$? || exit_status=$?
+
+if [[ $exit_status -ne 0 ]]; then
+ echo "::warning::Unable to locate the current sha: $CURRENT_SHA"
+ echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth:
2'. See https://github.com/tj-actions/changed-files#usage"
+ git remote remove temp_changed_files
+ exit 1
+fi
+
+if [[ -z $GITHUB_BASE_REF ]]; then
+ TARGET_BRANCH=${GITHUB_REF/refs\/heads\//}
+ CURRENT_BRANCH=$TARGET_BRANCH
+
+ if [[ -z $INPUT_BASE_SHA ]]; then
+ PREVIOUS_SHA=$(git rev-parse HEAD^1 2>&1) && exit_status=$? ||
exit_status=$?
+ else
+ PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?
+ TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) &&
exit_status=$? || exit_status=$?
+ fi
+
+ git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1 &&
exit_status=$? || exit_status=$?
+
+ if [[ $exit_status -ne 0 ]]; then
+ echo "::warning::Unable to locate the previous sha: $PREVIOUS_SHA"
+ echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth:
2'. See https://github.com/tj-actions/changed-files#usage"
+ git remote remove temp_changed_files
+ exit 1
+ fi
+else
+ TARGET_BRANCH=$GITHUB_BASE_REF
+ CURRENT_BRANCH=$GITHUB_HEAD_REF
+
+ if [[ -z $INPUT_BASE_SHA ]]; then
+ git fetch --no-tags -u --progress --depth=1 temp_changed_files
"${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$?
+ PREVIOUS_SHA=$(git rev-parse "${TARGET_BRANCH}" 2>&1) && exit_status=$? ||
exit_status=$?
+ else
+ git fetch --no-tags -u --progress --depth=1 temp_changed_files
"$INPUT_BASE_SHA" && exit_status=$? || exit_status=$?
+ PREVIOUS_SHA=$INPUT_BASE_SHA
+ TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) &&
exit_status=$? || exit_status=$?
+ fi
+
+ git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1 &&
exit_status=$? || exit_status=$?
+
+ if [[ $exit_status -ne 0 ]]; then
+ echo "::warning::Unable to locate the previous sha: $PREVIOUS_SHA"
+ echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth:
2'. See https://github.com/tj-actions/changed-files#usage"
+ git remote remove temp_changed_files
+ exit 1
+ fi
+fi
+
+echo "Retrieving changes between $PREVIOUS_SHA ($TARGET_BRANCH) → $CURRENT_SHA
($CURRENT_BRANCH)"
+
+echo "Getting diff..."
+
+if [[ -z "$INPUT_FILES_PATTERN" ]]; then
+ ADDED=$(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA"
| awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ COPIED=$(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA"
| awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ MODIFIED=$(git diff --diff-filter=M --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ RENAMED=$(git diff --diff-filter=R --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ TYPE_CHANGED=$(git diff --diff-filter=T --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ ALL_CHANGED_AND_MODIFIED=$(git diff --diff-filter="*ACDMRTUX" --name-only
"$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s
d)$0}END{print s}')
+ ALL_CHANGED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ ALL_MODIFIED=$(git diff --diff-filter="ACMRD" --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+else
+ echo "Input files pattern: $INPUT_FILES_PATTERN"
+ FILES_PATTERN="^($INPUT_FILES_PATTERN)$"
+
+ ADDED=$(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA"
| grep -E "$FILES_PATTERN" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
+ COPIED=$(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA"
| grep -E "$FILES_PATTERN" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
+ DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | grep -E "$FILES_PATTERN" | awk -v d="|" '{s=(NR==1?s:s
d)$0}END{print s}')
+ MODIFIED=$(git diff --diff-filter=M --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | grep -E "$FILES_PATTERN" | awk -v d="|" '{s=(NR==1?s:s
d)$0}END{print s}')
+ RENAMED=$(git diff --diff-filter=R --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | grep -E "$FILES_PATTERN" | awk -v d="|" '{s=(NR==1?s:s
d)$0}END{print s}')
+ TYPE_CHANGED=$(git diff --diff-filter=T --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | grep -E "$FILES_PATTERN" | awk -v d="|" '{s=(NR==1?s:s
d)$0}END{print s}')
+ UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | grep -E "$FILES_PATTERN" | awk -v d="|" '{s=(NR==1?s:s
d)$0}END{print s}')
+ UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | grep -E "$FILES_PATTERN" | awk -v d="|" '{s=(NR==1?s:s
d)$0}END{print s}')
+ ALL_CHANGED_AND_MODIFIED=$(git diff --diff-filter="*ACDMRTUX" --name-only
"$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "$FILES_PATTERN" | awk -v d="|"
'{s=(NR==1?s:s d)$0}END{print s}')
+ ALL_CHANGED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | grep -E "$FILES_PATTERN" | awk -v d="|" '{s=(NR==1?s:s
d)$0}END{print s}')
+ ALL_MODIFIED=$(git diff --diff-filter="ACMRD" --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | grep -E "$FILES_PATTERN" | awk -v d="|" '{s=(NR==1?s:s
d)$0}END{print s}')
+
+ ALL_OTHER_CHANGED=$(git diff --diff-filter="ACMR" --name-only
"$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
+ UNIQUE_ALL_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print
$0;}' | awk '!a[$0]++' | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
+
+ if [[ -n "${UNIQUE_ALL_CHANGED}" ]]; then
+ echo "Matching changed files: ${UNIQUE_ALL_CHANGED}"
+ echo "::set-output name=any_changed::true"
+ else
+ echo "::set-output name=any_changed::false"
+ fi
+
+ OTHER_CHANGED=""
+
+ if [[ -n $ALL_OTHER_CHANGED ]]; then
+ if [[ -n "$UNIQUE_ALL_CHANGED" ]]; then
+ OTHER_CHANGED=$(echo "${ALL_OTHER_CHANGED}|${UNIQUE_ALL_CHANGED}" | awk
'{gsub(/\|/,"\n"); print $0;}' | sort | uniq -u | awk -v d="|" '{s=(NR==1?s:s
d)$0}END{print s}')
+ else
+ OTHER_CHANGED=$ALL_OTHER_CHANGED
+ fi
+ fi
+
+ OTHER_CHANGED=$(echo "${OTHER_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}'
| awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+
+ if [[ -n "${OTHER_CHANGED}" ]]; then
+ echo "Non Matching changed files: ${OTHER_CHANGED}"
+ echo "::set-output name=only_changed::false"
+ echo "::set-output name=other_changed_files::$OTHER_CHANGED"
+ elif [[ -n "${UNIQUE_ALL_CHANGED}" ]]; then
+ echo "::set-output name=only_changed::true"
+ fi
+
+ ALL_OTHER_MODIFIED=$(git diff --diff-filter="ACMRD" --name-only
"$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
+ UNIQUE_ALL_MODIFIED=$(echo "${ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print
$0;}' | awk '!a[$0]++' | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
+
+ if [[ -n "${UNIQUE_ALL_MODIFIED}" ]]; then
+ echo "Matching modified files: ${UNIQUE_ALL_MODIFIED}"
+ echo "::set-output name=any_modified::true"
+ else
+ echo "::set-output name=any_modified::false"
+ fi
+
+ OTHER_MODIFIED=""
+
+ if [[ -n $ALL_OTHER_MODIFIED ]]; then
+ if [[ -n "$UNIQUE_ALL_MODIFIED" ]]; then
+ OTHER_MODIFIED=$(echo "${ALL_OTHER_MODIFIED}|${UNIQUE_ALL_MODIFIED}" |
awk '{gsub(/\|/,"\n"); print $0;}' | sort | uniq -u | awk -v d="|"
'{s=(NR==1?s:s d)$0}END{print s}')
+ else
+ OTHER_MODIFIED=$ALL_OTHER_MODIFIED
+ fi
+ fi
+
+ OTHER_MODIFIED=$(echo "${OTHER_MODIFIED}" | awk '{gsub(/\|/,"\n"); print
$0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+
+ if [[ -n "${OTHER_MODIFIED}" ]]; then
+ echo "Non Matching modified files: ${OTHER_MODIFIED}"
+ echo "::set-output name=only_modified::false"
+ echo "::set-output name=other_modified_files::$OTHER_MODIFIED"
+ elif [[ -n "${UNIQUE_ALL_MODIFIED}" ]]; then
+ echo "::set-output name=only_modified::true"
+ fi
+
+ ALL_OTHER_DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA"
"$CURRENT_SHA" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
+ UNIQUE_ALL_DELETED=$(echo "${DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}'
| awk '!a[$0]++' | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
+
+ if [[ -n "${UNIQUE_ALL_DELETED}" ]]; then
+ echo "Matching deleted files: ${UNIQUE_ALL_DELETED}"
+ echo "::set-output name=any_deleted::true"
+ else
+ echo "::set-output name=any_deleted::false"
+ fi
+
+ OTHER_DELETED=""
+
+ if [[ -n $ALL_OTHER_DELETED ]]; then
+ if [[ -n "$UNIQUE_ALL_DELETED" ]]; then
+ OTHER_DELETED=$(echo "${ALL_OTHER_DELETED}|${UNIQUE_ALL_DELETED}" | awk
'{gsub(/\|/,"\n"); print $0;}' | sort | uniq -u | awk -v d="|" '{s=(NR==1?s:s
d)$0}END{print s}')
+ else
+ OTHER_DELETED=$ALL_OTHER_DELETED
+ fi
+ fi
+
+ OTHER_DELETED=$(echo "${OTHER_DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}'
| awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+
+ if [[ -n "${OTHER_DELETED}" ]]; then
+ echo "Non Matching deleted files: ${OTHER_DELETED}"
+ echo "::set-output name=only_deleted::false"
+ echo "::set-output name=other_deleted_files::$OTHER_DELETED"
+ elif [[ -n "${UNIQUE_ALL_DELETED}" ]]; then
+ echo "::set-output name=only_deleted::true"
+ fi
+
+ ADDED=$(echo "${ADDED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v
d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ COPIED=$(echo "${COPIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v
d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ DELETED=$(echo "${DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v
d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ MODIFIED=$(echo "${MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v
d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ RENAMED=$(echo "${RENAMED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v
d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ TYPE_CHANGED=$(echo "${TYPE_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' |
awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ UNMERGED=$(echo "${UNMERGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v
d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ UNKNOWN=$(echo "${UNKNOWN}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v
d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ ALL_CHANGED_AND_MODIFIED=$(echo "${ALL_CHANGED_AND_MODIFIED}" | awk
'{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s
d)$0}END{print s}')
+ ALL_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' |
awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+ ALL_MODIFIED=$(echo "${ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' |
awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
+fi
+
+echo "Added files: $ADDED"
+echo "Copied files: $COPIED"
+echo "Deleted files: $DELETED"
+echo "Modified files: $MODIFIED"
+echo "Renamed files: $RENAMED"
+echo "Type Changed files: $TYPE_CHANGED"
+echo "Unmerged files: $UNMERGED"
+echo "Unknown files: $UNKNOWN"
+echo "All changed and modified files: $ALL_CHANGED_AND_MODIFIED"
+echo "All changed files: $ALL_CHANGED"
+echo "All modified files: $ALL_MODIFIED"
+
+git remote remove temp_changed_files
+
+echo "::set-output name=added_files::$ADDED"
+echo "::set-output name=copied_files::$COPIED"
+echo "::set-output name=deleted_files::$DELETED"
+echo "::set-output name=modified_files::$MODIFIED"
+echo "::set-output name=renamed_files::$RENAMED"
+echo "::set-output name=type_changed_files::$TYPE_CHANGED"
+echo "::set-output name=unmerged_files::$UNMERGED"
+echo "::set-output name=unknown_files::$UNKNOWN"
+echo "::set-output
name=all_changed_and_modified_files::$ALL_CHANGED_AND_MODIFIED"
+echo "::set-output name=all_changed_files::$ALL_CHANGED"
+echo "::set-output name=all_modified_files::$ALL_MODIFIED"
+
+echo "::endgroup::"
diff --git a/.github/actions/changed-files/sourcefiles.sh
b/.github/actions/changed-files/sourcefiles.sh
new file mode 100644
index 0000000..a2e459b
--- /dev/null
+++ b/.github/actions/changed-files/sourcefiles.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+set -e
+
+echo "::group::changed-files-from-source-file"
+
+RAW_FILES=()
+
+if [[ -n $INPUT_FILES_FROM_SOURCE_FILE ]]; then
+ for file in $INPUT_FILES_FROM_SOURCE_FILE
+ do
+ while read -r fileName; do
+ RAW_FILES+=("$fileName")
+ done <"$file"
+ done
+fi
+
+IFS=" " read -r -a CLEAN_FILES <<< "$(echo "${RAW_FILES[*]}" | tr "\r\n" "\n"
| tr " " "\n" | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
+
+IFS=" " read -r -a CLEAN_INPUT_FILES <<< "$(echo "${INPUT_FILES}" | tr "\r\n"
"\n" | tr " " "\n" | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
+
+FILES=("${CLEAN_FILES[@]}" "${CLEAN_INPUT_FILES[@]}")
+
+IFS=" " read -r -a ALL_UNIQUE_FILES <<< "$(echo "${FILES[@]}" | tr "\r\n" "\n"
| tr " " "\n" | awk '!a[$0]++' | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print
s}')"
+
+echo "Input files: ${ALL_UNIQUE_FILES[*]}"
+
+echo "::set-output name=files::${ALL_UNIQUE_FILES[*]}"
+
+echo "::endgroup::"
diff --git a/.github/workflows/ci-pulsar-website-next-build.yaml
b/.github/workflows/ci-pulsar-website-next-build.yaml
index b67dc8d..f492025 100644
--- a/.github/workflows/ci-pulsar-website-next-build.yaml
+++ b/.github/workflows/ci-pulsar-website-next-build.yaml
@@ -38,25 +38,24 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v2
- - name: Get changed files
- run: |
- git diff --name-only ${{ github.event.before }}..${{
github.event.after }}
- CHANGED_FILES=$(git diff --name-only ${{ github.event.before }}..${{
github.event.after }})
- echo "change files..."
- echo $CHANGED_FILES
-
# - name: Get changed files
- # id: changed-files
- # uses: tj-actions/[email protected]
- # with:
- # token: ${{ secrets.PULSARBOT_TOKEN }}
-
- # - name: List all modified files
# run: |
- # echo ${{ steps.changed-files.outputs.all_modified_files }}
- # for file in ${{ steps.changed-files.outputs.all_modified_files }};
do
- # echo "$file was modified"
- # done
+ # git diff --name-only ${{ github.event.before }}..${{
github.event.after }}
+ # CHANGED_FILES=$(git diff --name-only ${{ github.event.before
}}..${{ github.event.after }})
+ # echo "change files..."
+ # echo $CHANGED_FILES
+
+ - name: Get changed files
+ uses: ./.github/actions/changed-files
+ with:
+ token: ${{ secrets.PULSARBOT_TOKEN }}
+
+ - name: List all modified files
+ run: |
+ echo ${{ steps.changed-files.outputs.all_modified_files }}
+ for file in ${{ steps.changed-files.outputs.all_modified_files }}; do
+ echo "$file was modified"
+ done
# - name: Tune Runner VM