@@ -53,92 +53,103 @@ jobs:
53
53
- name : Get commits since last tag
54
54
id : commits
55
55
run : |
56
- PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
57
- if [ -z "$PREV_TAG" ]; then
58
- echo "No previous tag found, using initial commit."
59
- COMMITS="<ul>"
60
- while read -r commit_hash; do
61
- COMMIT_MSG=$(git log -n 1 --pretty=format:"%s" "$commit_hash")
62
- AUTHOR=$(gh api "/repos/${{ github.repository }}/commits/$commit_hash" --jq '.author.login')
63
- COMMITS+="<li>$COMMIT_MSG (@$AUTHOR)</li>"
64
- done < <(git log --format="%H" HEAD)
65
- COMMITS+="</ul>"
56
+ # Získání aktuálního tagu
57
+ CURRENT_TAG=$(git describe --tags --abbrev=0 HEAD)
58
+
59
+ # Kontrola, zda je aktuální tag stabilní (neobsahuje -beta, -rc apod.)
60
+ if [[ "$CURRENT_TAG" =~ -(beta|rc) ]]; then
61
+ # Pro beta/rc verze najdi předchozí libovolný tag
62
+ PREV_TAG=$(git describe --tags --abbrev=0 HEAD^)
66
63
else
67
- COMMITS="<ul>"
68
- declare -A FIXUPS
69
-
70
- # Iterace přes všechny commity od posledního tagu
71
- while read -r commit_hash; do
72
- COMMIT_MSG=$(git log -n 1 --pretty=format:"%s" "$commit_hash")
73
- AUTHOR=$(gh api "/repos/${{ github.repository }}/commits/$commit_hash" --jq '.author.login')
74
-
75
- # Kontrola, zda jde o fixup commit
76
- if [[ "$COMMIT_MSG" == fixup!* ]]; then
77
- ORIGINAL_HASH=$(git log -n 1 --format="%H" "$commit_hash"^)
78
- FIXUPS["$ORIGINAL_HASH"]+="$commit_hash "
79
- continue
80
- fi
81
-
82
- # Hledání uzavřených issue nebo PR pro tento commit
83
- COMMIT_URL="https://github.com/${{ github.repository }}/commit/$commit_hash"
84
- echo "Checking commit: $COMMIT_URL"
64
+ # Pro stabilní verze najdi poslední stabilní tag (ignoruj beta/rc tagy)
65
+ PREV_TAG=$(git tag --sort=-creatordate | grep -E '^[^ ]+$' | grep -Ev '-(beta|rc)' | head -n 1)
66
+ fi
85
67
86
- ISSUE_URLS=$(gh api "/repos/${{ github.repository }}/issues?state=closed" --jq "[.[] | select(.body != null and (.body | test(\"(Resolve|Close).*${commit_hash}\")))][].html_url" || echo "")
87
- ISSUE_COMMENT_URLS=$(gh api "/repos/${{ github.repository }}/issues/comments" --jq "[.[] | select(.body != null and (.body | test(\"(Resolve|Close).*${commit_hash}\")))][].html_url" || echo "")
88
- PR_URLS=$(gh api "/repos/${{ github.repository }}/pulls?state=all" --jq "[.[] | select(.body != null and (.body | contains(\"${commit_hash}\")))][].html_url" || echo "")
89
- REFERENCES="$ISSUE_URLS $ISSUE_COMMENT_URLS"
68
+ # Pokud nebyl nalezen žádný předchozí tag, použij počáteční commit
69
+ if [ -z "$PREV_TAG" ]; then
70
+ echo "No previous tag found, using initial commit."
71
+ PREV_TAG=""
72
+ fi
90
73
91
- echo "VANILA"
74
+ #PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
92
75
93
- echo "$ISSUE_URLS"
94
- echo "$ISSUE_COMMENT_URLS"
95
- echo "$PR_URLS"
76
+ if [ -z "$PREV_TAG" ]; then
77
+ echo "No previous tag found, using initial commit."
78
+ PREV_TAG=$(git rev-list --max-parents=0 HEAD)
79
+ fi
96
80
97
- ISSUE_URLS=$(echo "$ISSUE_URLS" | sed 's/#issuecomment-[0-9]*//g')
98
- ISSUE_COMMENT_URLS=$(echo "$ISSUE_COMMENT_URLS" | sed 's/#issuecomment-[0-9]*//g')
81
+ COMMITS="<ul>"
82
+ declare -A FIXUPS
99
83
100
- echo "CLEARED"
101
- echo "$ISSUE_URLS"
102
- echo "$ISSUE_COMMENT_URLS"
103
- echo "$PR_URLS"
104
- # Zpracování běžného commitu
105
- COMMITS+="<li>$COMMIT_MSG (@$AUTHOR)"
106
-
107
- # Přidání všech odkazů na Issues
108
- if [[ -n "$ISSUE_URLS" ]]; then
109
- COMMITS+=", (Referenced in Issues: "
110
- # Seznam odkazů oddělený mezerou
111
- COMMITS+=$(echo "$ISSUE_URLS" | tr '\n' ' ' | sed -E "s|https://github.com/${{ github.repository }}/issues/([0-9]+)|<a href=\"https://github.com/${{ github.repository }}/issues/\1\">#\1</a>|g" | sed 's/ / , /g')
112
- COMMITS=$(echo "$COMMITS" | sed 's/, $//')
113
- COMMITS+=" )"
114
- fi
115
-
116
- # Přidání všech odkazů na komentáře
117
- if [[ -n "$ISSUE_COMMENT_URLS" ]]; then
118
- COMMITS+=", (Referenced in Comments: "
119
- # Seznam odkazů oddělený mezerou
120
- COMMITS+=$(echo "$ISSUE_COMMENT_URLS" | tr '\n' ' '| sed -E "s|https://github.com/${{ github.repository }}/issues/([0-9]+)|<a href=\"https://github.com/${{ github.repository }}/issues/\1\">#\1</a>|g" | sed 's/ / , /g')
121
- COMMITS=$(echo "$COMMITS" | sed 's/, $//')
122
- COMMITS+=" )"
123
- fi
124
-
125
- # Přidání všech odkazů na PRs
126
- if [[ -n "$PR_URLS" ]]; then
127
- COMMITS+=", (Referenced in PRs: "
128
- COMMITS+=$(echo "$PR_URLS" | tr '\n' ' '| sed -E "s|https://github.com/${{ github.repository }}/pulls/([0-9]+)|<a href=\"https://github.com/${{ github.repository }}/pulls/\1\">#\1</a>|g" | sed 's/ / , /g')
129
- COMMITS=$(echo "$COMMITS" | sed 's/, $//')
130
- COMMITS+=" )"
131
- fi
84
+ # Iterace přes všechny commity od posledního tagu
85
+ while read -r commit_hash; do
86
+ COMMIT_MSG=$(git log -n 1 --pretty=format:"%s" "$commit_hash")
87
+ AUTHOR=$(gh api "/repos/${{ github.repository }}/commits/$commit_hash" --jq '.author.login')
132
88
133
- COMMITS+="</li>"
134
- done < <(git log --format="%H" $PREV_TAG..HEAD)
135
- COMMITS+="</ul>"
136
- fi
89
+ # Kontrola, zda jde o fixup commit
90
+ if [[ "$COMMIT_MSG" == fixup!* ]]; then
91
+ ORIGINAL_HASH=$(git log -n 1 --format="%H" "$commit_hash"^)
92
+ FIXUPS["$ORIGINAL_HASH"]+="$commit_hash "
93
+ continue
94
+ fi
95
+
96
+ # Hledání uzavřených issue nebo PR pro tento commit
97
+ COMMIT_URL="https://github.com/${{ github.repository }}/commit/$commit_hash"
98
+ echo "Checking commit: $COMMIT_URL"
99
+
100
+ ISSUE_URLS=$(gh api "/repos/${{ github.repository }}/issues?state=closed" --jq "[.[] | select(.body != null and (.body | test(\"(Resolve|Close).*${commit_hash}\")))][].html_url" || echo "")
101
+ ISSUE_COMMENT_URLS=$(gh api "/repos/${{ github.repository }}/issues/comments" --jq "[.[] | select(.body != null and (.body | test(\"(Resolve|Close).*${commit_hash}\")))][].html_url" || echo "")
102
+ PR_URLS=$(gh api "/repos/${{ github.repository }}/pulls?state=all" --jq "[.[] | select(.body != null and (.body | contains(\"${commit_hash}\")))][].html_url" || echo "")
103
+ REFERENCES="$ISSUE_URLS $ISSUE_COMMENT_URLS"
104
+
105
+ echo "VANILA"
106
+
107
+ echo "$ISSUE_URLS"
108
+ echo "$ISSUE_COMMENT_URLS"
109
+ echo "$PR_URLS"
110
+
111
+ ISSUE_URLS=$(echo "$ISSUE_URLS" | sed 's/#issuecomment-[0-9]*//g')
112
+ ISSUE_COMMENT_URLS=$(echo "$ISSUE_COMMENT_URLS" | sed 's/#issuecomment-[0-9]*//g')
113
+
114
+ echo "CLEARED"
115
+ echo "$ISSUE_URLS"
116
+ echo "$ISSUE_COMMENT_URLS"
117
+ echo "$PR_URLS"
118
+ # Zpracování běžného commitu
119
+ COMMITS+="<li>$COMMIT_MSG (@$AUTHOR)"
120
+
121
+ # Přidání všech odkazů na Issues
122
+ if [[ -n "$ISSUE_URLS" ]]; then
123
+ COMMITS+=", (Referenced in Issues: "
124
+ # Seznam odkazů oddělený mezerou
125
+ COMMITS+=$(echo "$ISSUE_URLS" | tr '\n' ' ' | sed -E "s|https://github.com/${{ github.repository }}/issues/([0-9]+)|<a href=\"https://github.com/${{ github.repository }}/issues/\1\">#\1</a>|g" | sed 's/ / , /g')
126
+ COMMITS=$(echo "$COMMITS" | sed 's/, $//')
127
+ COMMITS+=" )"
128
+ fi
129
+
130
+ # Přidání všech odkazů na komentáře
131
+ if [[ -n "$ISSUE_COMMENT_URLS" ]]; then
132
+ COMMITS+=", (Referenced in Comments: "
133
+ # Seznam odkazů oddělený mezerou
134
+ COMMITS+=$(echo "$ISSUE_COMMENT_URLS" | tr '\n' ' '| sed -E "s|https://github.com/${{ github.repository }}/issues/([0-9]+)|<a href=\"https://github.com/${{ github.repository }}/issues/\1\">#\1</a>|g" | sed 's/ / , /g')
135
+ COMMITS=$(echo "$COMMITS" | sed 's/, $//')
136
+ COMMITS+=" )"
137
+ fi
138
+
139
+ # Přidání všech odkazů na PRs
140
+ if [[ -n "$PR_URLS" ]]; then
141
+ COMMITS+=", (Referenced in PRs: "
142
+ COMMITS+=$(echo "$PR_URLS" | tr '\n' ' '| sed -E "s|https://github.com/${{ github.repository }}/pulls/([0-9]+)|<a href=\"https://github.com/${{ github.repository }}/pulls/\1\">#\1</a>|g" | sed 's/ / , /g')
143
+ COMMITS=$(echo "$COMMITS" | sed 's/, $//')
144
+ COMMITS+=" )"
145
+ fi
146
+
147
+ COMMITS+="</li>"
148
+ done < <(git log --format="%H" $PREV_TAG..HEAD)
149
+ COMMITS+="</ul>"
137
150
138
- echo "Result: $COMMITS"
139
151
# Odstranění nechtěných znaků
140
152
COMMITS=$(echo "$COMMITS" | sed 's/[[:cntrl:]]//g')
141
- echo "Result clear: $COMMITS"
142
153
echo "commits=$COMMITS" >> $GITHUB_ENV
143
154
env :
144
155
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments