You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ti...@apache.org on 2022/12/14 10:18:40 UTC
[pulsar-site] branch main updated: Simplify get changed files (#332)
This is an automated email from the ASF dual-hosted git repository.
tison 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 f1eb9f83e81 Simplify get changed files (#332)
f1eb9f83e81 is described below
commit f1eb9f83e8112db8d0f1271cf99f77caf7329c43
Author: tison <wa...@gmail.com>
AuthorDate: Wed Dec 14 18:18:34 2022 +0800
Simplify get changed files (#332)
Signed-off-by: tison <wa...@gmail.com>
---
.github/actions/changed-files/action.yml | 167 ------------------
.github/actions/changed-files/entrypoint.sh | 253 ---------------------------
.github/actions/changed-files/sourcefiles.sh | 30 ----
.github/actions/glob/action.yml | 78 ---------
.github/actions/glob/main.js | 37 ----
.github/workflows/ci-build-site.yml | 8 +-
6 files changed, 3 insertions(+), 570 deletions(-)
diff --git a/.github/actions/changed-files/action.yml b/.github/actions/changed-files/action.yml
deleted file mode 100644
index 39ea0075f9a..00000000000
--- a/.github/actions/changed-files/action.yml
+++ /dev/null
@@ -1,167 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-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: ./.github/actions/glob
- 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
deleted file mode 100755
index dcd6fe79192..00000000000
--- a/.github/actions/changed-files/entrypoint.sh
+++ /dev/null
@@ -1,253 +0,0 @@
-#!/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
deleted file mode 100644
index a2e459b0b1e..00000000000
--- a/.github/actions/changed-files/sourcefiles.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/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/actions/glob/action.yml b/.github/actions/glob/action.yml
deleted file mode 100644
index 999d201d112..00000000000
--- a/.github/actions/glob/action.yml
+++ /dev/null
@@ -1,78 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-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
diff --git a/.github/actions/glob/main.js b/.github/actions/glob/main.js
deleted file mode 100644
index 05992805445..00000000000
--- a/.github/actions/glob/main.js
+++ /dev/null
@@ -1,37 +0,0 @@
-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));
-};
diff --git a/.github/workflows/ci-build-site.yml b/.github/workflows/ci-build-site.yml
index 5ba3debb708..d1c098e9f76 100644
--- a/.github/workflows/ci-build-site.yml
+++ b/.github/workflows/ci-build-site.yml
@@ -28,16 +28,14 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 600
steps:
- - name: checkout
- uses: actions/checkout@v3
+ - uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get changed files
- uses: ./.github/actions/changed-files
id: changed-files
- with:
- token: ${{ secrets.PULSARBOT_TOKEN }}
+ run: |
+ echo "all_changed_and_modified_files=$(git diff --name-only HEAD~1 HEAD | tr '\n' ' ')" >> $GITHUB_OUTPUT
- name: List all modified files
run: |