Skip to content

[New Project Title]: image gen #46

[New Project Title]: image gen

[New Project Title]: image gen #46

name: Process Issue
on:
issues:
types: [closed]
jobs:
process-issue:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Append issue body to projects.json
run: |
BODY=$(echo "${{ github.event.issue.body }}" | jq -sR .)
JSON_OBJECT="{\"content\": $BODY}"
if [[ -f projects.json ]]; then
# Read the existing JSON array and append the new object
OLD_CONTENT=$(cat projects.json)
if [[ $OLD_CONTENT == "" ]]; then
echo "[$JSON_OBJECT]" > projects.json
else
OLD_CONTENT_NO_BRACKETS=$(echo "$OLD_CONTENT" | jq -r .[])
echo "[$OLD_CONTENT_NO_BRACKETS,$JSON_OBJECT]" > projects.json
fi
else
# Create the file with the initial JSON array
echo "[$JSON_OBJECT]" > projects.json
fi
- name: Commit and push changes
run: |
git config --global user.name 'GitHub Actions Bot'
git config --global user.email 'actions@github.com'
git add projects.json
git commit -m "Update projects.json with issue body"
git checkout -b projects
git push origin projects --force