Revert "CI: rework the patch-doc script and workflow"

This commit is contained in:
uazo
2024-06-15 06:37:19 -01:00
committed by GitHub
parent e65dfa2f09
commit 915b115fbe
4 changed files with 56 additions and 42 deletions
+4 -14
View File
@@ -1,15 +1,5 @@
root = true
[*]
charset = utf-8
end_of_line = lf
[*.{yaml,sh,gn_args}]
tab_width = 2
indent_size = 2
indent_style = space
insert_final_newline = true
[*.sh]
indent_size = 4
indent_style = space
[*.patch]
insert_final_newline = false
end_of_line = crlf
indent_style = space
+15 -1
View File
@@ -32,19 +32,33 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Get value from dispatch"
run: |
if [ -z "${RTAG}" ]; then
echo "RTAG=$GITHUB_SHA" >> $GITHUB_ENV
echo "RTAG=$RTAG"
fi
- name: Checkout 'uazo/cromite' ${{ env.BRANCH }}
uses: actions/checkout@v2
with:
repository: 'uazo/cromite'
ref: ${{ github.event.inputs.rtag }}
path: 'cromite'
fetch-depth: 1
- name: Generate patches doc
run: |
bash ./tools/extract-all-patch-data.sh ./build/patches
export HOME=$GITHUB_WORKSPACE
bash ~/cromite/tools/extract-all-patch-data.sh ~/cromite/build/patches
- name: Check differences CHANGES=${{ env.CHANGES }}
run: |
export HOME=$GITHUB_WORKSPACE
cd ~/cromite
CHANGES=0 && git diff --quiet || CHANGES=1
echo "CHANGES=$CHANGES" >> $GITHUB_ENV
+10 -12
View File
@@ -1,18 +1,16 @@
#!/bin/bash
set -euo pipefail
FOLDER=$1
SCRIPT_FOLDER="$(dirname "$0")"
SCRIPT_FOLDER="$(realpath "$(dirname "$0")")"
SCRIPT="$SCRIPT_FOLDER/extract-patch-data.sh"
OUTPUT="$SCRIPT_FOLDER"/../docs/PATCHES.md
test -f $OUTPUT && rm $OUTPUT
OUTPUT="$SCRIPT_FOLDER/../docs/PATCHES.md"
rm -f "$OUTPUT"
for filename in "$FOLDER"/*.patch; do
bash $SCRIPT_FOLDER/extract-patch-data.sh $filename >>$OUTPUT
done
pushd "$1" >/dev/null
sort -k1 -t"|" -o $OUTPUT $OUTPUT
for filename in *.patch; do
(echo "Filename: $filename"; cat "$filename") | bash "$SCRIPT"
done | sort -k1 -t"|" -o "$OUTPUT"
sed -i '1s/^/| Patch | Message |\n/' "$OUTPUT"
sed -i '2s/^/|--------|--------|\n/' "$OUTPUT"
sed -i '1s/^/| Patch | Message |\n/' $OUTPUT
sed -i '2s/^/|--------|--------|\n/' $OUTPUT
+27 -15
View File
@@ -1,31 +1,37 @@
#!/bin/bash
set -euo pipefail
PATCH=$1
CR=$(printf "\r")
while read -r current_line; do
if [[ $current_line =~ ^Filename:* ]]; then
FILENAME=${current_line:9}
elif [[ $current_line =~ ^Subject:* ]]; then
cat $PATCH | (
while read current_line
do
if [[ $current_line =~ ^Subject:* ]]; then
SUBJECT=${current_line:8}
elif [[ $current_line =~ ^Date:* ]]; then
DATE=${current_line:5}
elif [[ $current_line =~ ^License:* ]]; then
LICENSE=$(echo "${current_line:9}" | cut -d ' ' -f1)
LICENSE=`echo ${current_line:9} | cut -d ' ' -f1`
elif [[ $current_line =~ ^Category:* ]]; then
CATEGORY=`echo ${current_line:9} | cut -d ' ' -f1`
elif [[ $current_line =~ ^"Original License:"* ]]; then
continue
elif [[ $current_line =~ ^From:* ]]; then
FROM=$(echo "${current_line:5}" | cut -d ' ' -f1)
FROM=`echo ${current_line:5} | cut -d ' ' -f1`
elif [[ $current_line =~ ^Context:* ]]; then
CONTEXT=${current_line:8}
elif [[ $current_line =~ ^---* ]]; then
break
elif [ -n "$current_line" ]; then
if [ -n "$MESSAGE" ]; then
elif [ ! -z "$current_line" ]; then
if [ ! -z "$MESSAGE" ]; then
MESSAGE+="<br>"
fi
MESSAGE+=$current_line
@@ -37,11 +43,17 @@ done
# echo SUBJECT: $SUBJECT
# echo DATE: $DATE
# echo LICENSE: $LICENSE
# echo CONTEXT: $CONTEXT
# echo CATEGORY: $CATEGORY
# echo -e MESSAGE: $MESSAGE
SUBJECT=`echo $SUBJECT | xargs`
echo "|**$SUBJECT**" \
"<br><sub><nobr>$DATE</nobr>" \
"<br>File: [$FILENAME](/build/patches/$FILENAME)" \
"<br><nobr>Author: $FROM</nobr>" \
"<br><nobr>License: $LICENSE</nobr>" \
"|$MESSAGE|"
"<br><sub><nobr>"$DATE"</nobr>" \
"<br>File: [$(basename $PATCH)](/build/patches/$(basename $PATCH))" \
"<br><nobr>Author: "$FROM"</nobr>" \
"<br><nobr>Context: "$CONTEXT"</nobr>" \
"<br><nobr>License: "$LICENSE"</nobr>" \
"|"$MESSAGE"|"
)