diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 1007330..e6594ed 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -56,19 +56,89 @@ jobs:
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -z "$PREV_TAG" ]; then
echo "No previous tag found, using initial commit."
- COMMITS=$(git log --format="- %s (@%an)" HEAD)
+ COMMITS="
"
+ while read -r commit_hash; do
+ COMMIT_MSG=$(git log -n 1 --pretty=format:"%s" "$commit_hash")
+ AUTHOR=$(gh api "/repos/${{ github.repository }}/commits/$commit_hash" --jq '.author.login')
+ COMMITS+="- $COMMIT_MSG (@$AUTHOR)
"
+ done < <(git log --format="%H" HEAD)
+ COMMITS+="
"
else
- COMMITS=""
+ COMMITS=""
+ declare -A FIXUPS
+
+ # Iterace přes všechny commity od posledního tagu
while read -r commit_hash; do
COMMIT_MSG=$(git log -n 1 --pretty=format:"%s" "$commit_hash")
AUTHOR=$(gh api "/repos/${{ github.repository }}/commits/$commit_hash" --jq '.author.login')
- COMMITS+="- $COMMIT_MSG (@$AUTHOR)"
- COMMITS+=$'\n'
+
+ # Kontrola, zda jde o fixup commit
+ if [[ "$COMMIT_MSG" == fixup!* ]]; then
+ ORIGINAL_HASH=$(git log -n 1 --format="%H" "$commit_hash"^)
+ FIXUPS["$ORIGINAL_HASH"]+="$commit_hash "
+ continue
+ fi
+
+ # Hledání uzavřených issue nebo PR pro tento commit
+ COMMIT_URL="https://github.com/${{ github.repository }}/commit/$commit_hash"
+ echo "Checking commit: $COMMIT_URL"
+
+ ISSUE_URLS=$(gh api "/repos/${{ github.repository }}/issues?state=closed" --jq "[.[] | select(.body != null and (.body | test(\"(Resolve|Close).*${commit_hash}\")))][].html_url" || echo "")
+ ISSUE_COMMENT_URLS=$(gh api "/repos/${{ github.repository }}/issues/comments" --jq "[.[] | select(.body != null and (.body | test(\"(Resolve|Close).*${commit_hash}\")))][].html_url" || echo "")
+ PR_URLS=$(gh api "/repos/${{ github.repository }}/pulls?state=all" --jq "[.[] | select(.body != null and (.body | contains(\"${commit_hash}\")))][].html_url" || echo "")
+ REFERENCES="$ISSUE_URLS $ISSUE_COMMENT_URLS"
+
+ echo "VANILA"
+
+ echo "$ISSUE_URLS"
+ echo "$ISSUE_COMMENT_URLS"
+ echo "$PR_URLS"
+
+ ISSUE_URLS=$(echo "$ISSUE_URLS" | sed 's/#issuecomment-[0-9]*//g')
+ ISSUE_COMMENT_URLS=$(echo "$ISSUE_COMMENT_URLS" | sed 's/#issuecomment-[0-9]*//g')
+
+ echo "CLEARED"
+ echo "$ISSUE_URLS"
+ echo "$ISSUE_COMMENT_URLS"
+ echo "$PR_URLS"
+ # Zpracování běžného commitu
+ COMMITS+="- $COMMIT_MSG (@$AUTHOR)"
+
+ # Přidání všech odkazů na Issues
+ if [[ -n "$ISSUE_URLS" ]]; then
+ COMMITS+=", (Referenced in Issues: "
+ # Seznam odkazů oddělený mezerou
+ COMMITS+=$(echo "$ISSUE_URLS" | tr '\n' ' ' | sed -E "s|https://github.com/${{ github.repository }}/issues/([0-9]+)|#\1|g" | sed 's/ / , /g')
+ COMMITS=$(echo "$COMMITS" | sed 's/, $//')
+ COMMITS+=" )"
+ fi
+
+ # Přidání všech odkazů na komentáře
+ if [[ -n "$ISSUE_COMMENT_URLS" ]]; then
+ COMMITS+=", (Referenced in Comments: "
+ # Seznam odkazů oddělený mezerou
+ COMMITS+=$(echo "$ISSUE_COMMENT_URLS" | tr '\n' ' '| sed -E "s|https://github.com/${{ github.repository }}/issues/([0-9]+)|#\1|g" | sed 's/ / , /g')
+ COMMITS=$(echo "$COMMITS" | sed 's/, $//')
+ COMMITS+=" )"
+ fi
+
+ # Přidání všech odkazů na PRs
+ if [[ -n "$PR_URLS" ]]; then
+ COMMITS+=", (Referenced in PRs: "
+ COMMITS+=$(echo "$PR_URLS" | tr '\n' ' '| sed -E "s|https://github.com/${{ github.repository }}/pulls/([0-9]+)|#\1|g" | sed 's/ / , /g')
+ COMMITS=$(echo "$COMMITS" | sed 's/, $//')
+ COMMITS+=" )"
+ fi
+
+ COMMITS+="
"
done < <(git log --format="%H" $PREV_TAG..HEAD)
+ COMMITS+="
"
fi
-
+
+ echo "Result: $COMMITS"
+ # Odstranění nechtěných znaků
COMMITS=$(echo "$COMMITS" | sed 's/[[:cntrl:]]//g')
-
+ echo "Result clear: $COMMITS"
echo "commits=$COMMITS" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -83,16 +153,4 @@ jobs:
${{ env.commits }}
draft: false
prerelease: ${{ env.prerelease }}
- name: ${{ github.ref_name }} - ${{ env.release_type }}
-
-# - name: Create release
-# uses: actions/create-release@v1
-# env:
-# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-# with:
-# tag_name: ${{ github.ref_name }}
-# release_name: ${{ github.ref_name }} - ${{ env.release_type }}
-# body: |
-# ${{ env.commits }}
-# draft: false
-# prerelease: ${{ env.prerelease }}
+ name: ${{ github.ref_name }} - ${{ env.release_type }}
\ No newline at end of file
diff --git a/router.go b/router.go
index 68c9a75..09c3859 100644
--- a/router.go
+++ b/router.go
@@ -22,6 +22,7 @@ type ErrorHandlerFunc func(c *gin.Context)
type Router struct {
router *gin.Engine
routes map[string]*Route
+ middlewares []interface{}
errorHandlers map[int]ErrorHandlerFunc
defaultHandler ErrorHandlerFunc
}