You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TRaSH-Guides/.github/scripts/update-changelog.sh

21 lines
575 B

#!/bin/bash
log_file="$1"
output_file="docs/updates.txt"
current_time=$(date +"%F %H:%M")
formatted_output="# $current_time"
while IFS= read -r message; do
pr_number=$(echo "$message" | grep -oE '\(#[0-9]+\)$' | tr -d '(#)')
formatted_message=$(echo "$message" | sed -E 's/ \(#[0-9]+\)$//')
formatted_output+="
- [$formatted_message](https://github.com/TRaSH-Guides/Guides/pull/${pr_number})"
done < "$log_file"
formatted_output+="\n"
{
echo -e "$formatted_output"
cat "$output_file"
} > "${output_file}.tmp" && mv "${output_file}.tmp" "$output_file"