Skip to content

Commit ce1f002

Browse files
committed
it should
1 parent 671ba03 commit ce1f002

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

.github/workflows/event-submission.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,14 @@ jobs:
4242
with:
4343
node-version: '18'
4444

45-
# - name: Create new event branch
46-
# run: |
47-
# git config --global user.name 'GitHub Action'
48-
# git config --global user.email 'action@github.com'
49-
# branch_name="event-${{ github.event.inputs.title }}"
50-
# git checkout -b $branch_name
51-
5245
- name: Process image and detect format
5346
run: |
54-
mkdir -p "public/photos/events/${{ github.event.inputs.by }}"
47+
# Convert "by" field to lowercase
48+
LOWER_BY=$(echo "${{ github.event.inputs.by }}" | tr '[:upper:]' '[:lower:]')
49+
50+
mkdir -p "public/photos/events/$LOWER_BY"
5551
56-
curl "${{ github.event.inputs.image_url }}" > temp_image
52+
curl -o temp_image "${{ github.event.inputs.image_url }}"
5753
5854
FILE_TYPE=$(file -b --mime-type temp_image)
5955
@@ -66,7 +62,7 @@ jobs:
6662
exit 1
6763
fi
6864
69-
mv temp_image "public/photos/events/${{ github.event.inputs.by }}/${{ github.event.inputs.title }}.$EXTENSION"
65+
mv temp_image "public/photos/events/$LOWER_BY/${{ github.event.inputs.title }}.$EXTENSION"
7066
7167
echo "IMAGE_EXTENSION=$EXTENSION" >> $GITHUB_ENV
7268
@@ -80,15 +76,16 @@ jobs:
8076
const eventsFile = fs.readFileSync(eventsPath, "utf8");
8177
const events = require("./src/data/event.ts").EventDatas;
8278
79+
const LOWER_BY = "${{ github.event.inputs.by }}".toLowerCase();
8380
const newEvent = {
8481
id: Math.max(...events.map(e => e.id)) + 1,
8582
title: "${{ github.event.inputs.title }}",
8683
by: "${{ github.event.inputs.by }}",
87-
avatar: `/photos/clubs/${${{ github.event.inputs.by }}.toLowerCase()}.jpg`,
84+
avatar: `/photos/clubs/${LOWER_BY}.jpg`,
8885
date: "${{ github.event.inputs.date }}",
8986
registrationLink: "${{ github.event.inputs.registrationLink }}",
9087
description: `${{ github.event.inputs.description }}`,
91-
image: `/photos/events/${${{ github.event.inputs.by }}/${{ github.event.inputs.title }}.${process.env.IMAGE_EXTENSION}`,
88+
image: `/photos/events/${LOWER_BY}/${{ github.event.inputs.title }}.${process.env.IMAGE_EXTENSION}`,
9289
category: "${{ github.event.inputs.category }}".split(",").map(c => c.trim()),
9390
display: "${{ github.event.inputs.display }}".split(",").map(d => parseInt(d.trim()))
9491
};
@@ -111,6 +108,4 @@ jobs:
111108
- Categories: ${{ github.event.inputs.category }}
112109
113110
Please review and approve this event submission.
114-
# branch: event-${{ github.event.inputs.title }}
115-
branch: main # Work on prod
116-
# delete-branch: true
111+
branch: main # Work on prod

0 commit comments

Comments
 (0)