mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-25 05:57:26 +00:00
Use curl instead of wget
This commit is contained in:
@@ -7,7 +7,7 @@ on:
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
|
||||
jobs:
|
||||
post_to_discord:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -24,15 +24,15 @@ jobs:
|
||||
run: |
|
||||
REPO="community-scripts/ProxmoxVED"
|
||||
API_URL="https://api.github.com/repos/$REPO/contents"
|
||||
|
||||
|
||||
FILES=(
|
||||
"ct/${{ env.TITLE }}.sh"
|
||||
"install/${{ env.TITLE }}-install.sh"
|
||||
"frontend/public/json/${{ env.TITLE }}.json"
|
||||
)
|
||||
|
||||
|
||||
EXISTING_FILES=()
|
||||
|
||||
|
||||
for FILE in "${FILES[@]}"; do
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GH_TOKEN" "$API_URL/$FILE")
|
||||
if [ "$STATUS" -eq 200 ]; then
|
||||
@@ -48,26 +48,26 @@ jobs:
|
||||
id: create_message
|
||||
run: |
|
||||
VAR="The ${{ env.TITLE }} script is ready for testing:\n"
|
||||
VAR+="\`\`\`bash -c \"\$(wget -qLO - https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${{ env.TITLE }}.sh)\"\`\`\`\n"
|
||||
VAR+="\`\`\`bash -c \"\$(curl -fsSL - https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${{ env.TITLE }}.sh)\"\`\`\`\n"
|
||||
if [[ " ${EXISTING_FILES[@]} " =~ " frontend/public/json/${TITLE}.json " ]]; then
|
||||
JSON=$(wget -qLO - https://github.com/community-scripts/ProxmoxVED/raw/main/frontend/public/json/${{ env.TITLE }}.json)
|
||||
JSON=$(curl -fsSL - https://github.com/community-scripts/ProxmoxVED/raw/main/frontend/public/json/${{ env.TITLE }}.json)
|
||||
username=$(echo "$JSON" | jq -r '.default_credentials.username')
|
||||
password=$(echo "$JSON" | jq -r '.default_credentials.password')
|
||||
mapfile -t notes_array < <(echo "$JSON" | jq -r '.notes[].text')
|
||||
|
||||
|
||||
if [[ -n "$username" && "$username" != "null" || -n "$password" && "$password" != "null" ]]; then
|
||||
VAR+="Default credentials:\n"
|
||||
|
||||
|
||||
if [[ -n "$username" && "$username" != "null" ]]; then
|
||||
VAR+="Username: $username\n"
|
||||
fi
|
||||
|
||||
|
||||
if [[ -n "$password" && "$password" != "null" ]]; then
|
||||
VAR+="Password: $password\n"
|
||||
fi
|
||||
VAR+="\n"
|
||||
fi
|
||||
|
||||
|
||||
if [ ${#notes_array[@]} -gt 0 ]; then
|
||||
for note in "${notes_array[@]}"; do
|
||||
VAR+="$note\n"
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
VAR+="Discussion & issue tracking:\n"
|
||||
VAR+="${{ github.event.issue.html_url }}"
|
||||
echo "message=$VAR" >> $GITHUB_ENV
|
||||
|
||||
|
||||
- name: Create a forumpost in Discord
|
||||
id: post_to_discord
|
||||
env:
|
||||
@@ -90,12 +90,12 @@ jobs:
|
||||
run: |
|
||||
JSON_PAYLOAD=$(jq -n --arg name "Wanted Tester for $TITLE" --arg content "$MESSAGE" '{name: $name, message: {content: $content | gsub("\\\\n"; "\n")}, applied_tags: []}')
|
||||
echo "JSON Payload: $JSON_PAYLOAD"
|
||||
|
||||
|
||||
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "https://discord.com/api/v10/channels/$DISCORD_CHANNEL_ID/threads" \
|
||||
-H "Authorization: Bot $DISCORD_BOT_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$JSON_PAYLOAD")
|
||||
|
||||
|
||||
STATUS_CODE=$(echo "$RESPONSE" | tail -n 1)
|
||||
if [ "$STATUS_CODE" -eq 201 ]; then
|
||||
echo "Discord post created successfully!"
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
echo "Failed to create Discord post! Status code: $STATUS_CODE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
- name: Comment on Issue
|
||||
id: comment_on_issue
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user