@@ -42,18 +42,14 @@ jobs:
42
42
with :
43
43
node-version : ' 18'
44
44
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
-
52
45
- name : Process image and detect format
53
46
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"
55
51
56
- curl "${{ github.event.inputs.image_url }}" > temp_image
52
+ curl -o temp_image "${{ github.event.inputs.image_url }}"
57
53
58
54
FILE_TYPE=$(file -b --mime-type temp_image)
59
55
66
62
exit 1
67
63
fi
68
64
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"
70
66
71
67
echo "IMAGE_EXTENSION=$EXTENSION" >> $GITHUB_ENV
72
68
@@ -80,15 +76,16 @@ jobs:
80
76
const eventsFile = fs.readFileSync(eventsPath, "utf8");
81
77
const events = require("./src/data/event.ts").EventDatas;
82
78
79
+ const LOWER_BY = "${{ github.event.inputs.by }}".toLowerCase();
83
80
const newEvent = {
84
81
id: Math.max(...events.map(e => e.id)) + 1,
85
82
title: "${{ github.event.inputs.title }}",
86
83
by: "${{ github.event.inputs.by }}",
87
- avatar: `/photos/clubs/${${{ github.event.inputs.by }}.toLowerCase() }.jpg`,
84
+ avatar: `/photos/clubs/${LOWER_BY }.jpg`,
88
85
date: "${{ github.event.inputs.date }}",
89
86
registrationLink: "${{ github.event.inputs.registrationLink }}",
90
87
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}`,
92
89
category: "${{ github.event.inputs.category }}".split(",").map(c => c.trim()),
93
90
display: "${{ github.event.inputs.display }}".split(",").map(d => parseInt(d.trim()))
94
91
};
@@ -111,6 +108,4 @@ jobs:
111
108
- Categories: ${{ github.event.inputs.category }}
112
109
113
110
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