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