Skip to content

Commit

Permalink
updated action
Browse files Browse the repository at this point in the history
  • Loading branch information
tadaspetra committed Dec 6, 2024
1 parent f62dbff commit 35e7b9a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/create-discussions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ jobs:
# Use the first changed file
CHANGED_FILE=$(echo "$CHANGED_FILES" | head -n 1)
# Verify file exists
if [ ! -f "$CHANGED_FILE" ]; then
echo "File $CHANGED_FILE not found"
exit 1
# Extract app name and check if it exists in votes file
NAME=$(grep -m 1 '^name: ' "$CHANGED_FILE" | sed -E 's/^name: "(.+)"$/\1/')
# Check if app already has a discussion by looking in votes file
if grep -q "\"$NAME\":" src/data/votes_*.json; then
echo "Discussion already exists for $NAME"
exit 0
fi
# Extract data using grep and sed with error checking and proper quote handling
NAME=$(grep -m 1 '^name: ' "$CHANGED_FILE" | sed -E 's/^name: "(.+)"$/\1/')
# Continue with existing code for new apps only...
AUTHOR=$(grep -m 1 '^author: ' "$CHANGED_FILE" | sed -E 's/^author: "(.+)"$/\1/')
DESCRIPTION=$(grep -m 1 '^description: ' "$CHANGED_FILE" | sed -E 's/^description: "(.+)"$/\1/')
Expand Down

0 comments on commit 35e7b9a

Please sign in to comment.