Update .forgejo/workflows/release-charts.yaml
This commit is contained in:
parent
6cfc060acc
commit
1055aec066
1 changed files with 10 additions and 8 deletions
|
@ -20,7 +20,7 @@ jobs:
|
|||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Ensures full history for accurate diffing
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Identify Merge Commit and List Changed Charts
|
||||
id: changed-charts
|
||||
|
@ -33,10 +33,8 @@ jobs:
|
|||
|
||||
if [ "$PARENT_COUNT" -gt 2 ]; then
|
||||
echo "This is a merge commit with $((PARENT_COUNT - 1)) parents."
|
||||
# For simplicity, comparing with the first parent
|
||||
PARENT_SHA=$(git rev-parse HEAD^1)
|
||||
elif [ "$PARENT_COUNT" -eq 2 ]; then
|
||||
# Regular commit with one parent
|
||||
PARENT_SHA=$(git rev-parse HEAD^1)
|
||||
else
|
||||
echo "Single commit with no parents. Listing all changes."
|
||||
|
@ -46,20 +44,24 @@ jobs:
|
|||
echo "Current Commit SHA: $CURRENT_SHA"
|
||||
echo "Parent Commit SHA: $PARENT_SHA"
|
||||
|
||||
# List changed files between parent and current commit
|
||||
CHANGED_FILES=$(git diff --name-only $PARENT_SHA $CURRENT_SHA)
|
||||
# List changed files and trim any extra line breaks
|
||||
CHANGED_FILES=$(git diff --name-only $PARENT_SHA $CURRENT_SHA | tr -d '\r')
|
||||
|
||||
echo "Changed files:"
|
||||
echo "$CHANGED_FILES"
|
||||
|
||||
# Filter changed files to include only those in 'charts/**'
|
||||
CHANGED_CHARTS=$(echo "$CHANGED_FILES" | grep '^charts/' | awk -F/ '{print $2}' | sort -u)
|
||||
# Extract chart directories
|
||||
CHANGED_CHARTS=$(echo "$CHANGED_FILES" | grep '^charts/' | awk -F/ '{print $2}' | sort -u | tr -d '\r')
|
||||
|
||||
echo "Changed charts:"
|
||||
echo "$CHANGED_CHARTS"
|
||||
|
||||
# Convert to JSON array
|
||||
CHANGED_CHARTS_JSON=$(echo "$CHANGED_CHARTS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
|
||||
if [ -z "$CHANGED_CHARTS" ]; then
|
||||
CHANGED_CHARTS_JSON="[]"
|
||||
else
|
||||
CHANGED_CHARTS_JSON=$(echo "$CHANGED_CHARTS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
|
||||
fi
|
||||
|
||||
echo "reposChanged=$CHANGED_CHARTS_JSON" >> $GITHUB_OUTPUT
|
||||
|
||||
|
|
Loading…
Reference in a new issue