Skip to content

Commit 52197b3

Browse files
authored
Merge pull request #7 from draphy/draphy/dro-64-test-draphyos-and-optimize
feat: [DRO-64] Release workflow update
2 parents 6457df7 + 046a66a commit 52197b3

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,15 @@ jobs:
173173
env:
174174
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
175175

176-
- name: Comment on merged PRs
176+
- name: Label and comment on merged PRs
177177
if: steps.version.outputs.skip != 'true'
178178
run: |
179179
LATEST_TAG="${{ steps.get_tag.outputs.latest_tag }}"
180180
NEW_VERSION="${{ steps.version.outputs.new_version }}"
181181
182+
# Ensure "released" label exists
183+
gh label create "released" --color "9ab87c" --description "Included in a release" 2>/dev/null || true
184+
182185
# Get PR numbers from commits since last tag
183186
if [ "$LATEST_TAG" = "v0.0.0" ]; then
184187
COMMITS=$(git log --pretty=format:"%H" HEAD)
@@ -187,17 +190,22 @@ jobs:
187190
fi
188191
189192
# Find PRs associated with these commits
190-
COMMENTED_PRS=""
193+
LABELED_PRS=""
191194
while IFS= read -r sha; do
192195
# Get PR number for this commit
193196
PR_DATA=$(gh pr list --state merged --search "$sha" --json number --jq '.[0].number' 2>/dev/null || echo "")
194197
195198
if [ -n "$PR_DATA" ] && [ "$PR_DATA" != "null" ]; then
196-
# Avoid duplicate comments
197-
if [[ ! "$COMMENTED_PRS" =~ "$PR_DATA" ]]; then
199+
# Avoid duplicate actions
200+
if [[ ! "$LABELED_PRS" =~ "$PR_DATA" ]]; then
201+
# Add "released" label
202+
gh pr edit "$PR_DATA" --add-label "released" 2>/dev/null || true
203+
204+
# Add comment with release link
198205
gh pr comment "$PR_DATA" --body "🚀 Released in [$NEW_VERSION](https://github.com/${{ github.repository }}/releases/tag/$NEW_VERSION)" 2>/dev/null || true
199-
COMMENTED_PRS="${COMMENTED_PRS} ${PR_DATA}"
200-
echo "Commented on PR #$PR_DATA"
206+
207+
LABELED_PRS="${LABELED_PRS} ${PR_DATA}"
208+
echo "Labeled and commented on PR #$PR_DATA"
201209
fi
202210
fi
203211
done <<< "$COMMITS"

0 commit comments

Comments
 (0)