Skip to content

Commit

Permalink
Update clean.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et authored Nov 27, 2024
1 parent 57a7a5b commit 666b7f8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/clean.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cleanup After Milestone PRs Merged
name: Cleanup After Milestone PRs Merged(Deprecated)

on:
pull_request:
Expand All @@ -20,22 +20,23 @@ jobs:
PR_TITLE="${{ github.event.pull_request.title }}"
echo "PR Title: $PR_TITLE"
PR_TITLE_ESCAPED=$(echo "$PR_TITLE" | sed 's/`/\\`/g')
# Extract PR numbers from the title
PR_NUMBERS=$(echo "$PR_TITLE" | grep -oE "#[0-9]+" | tr -d '#' | tr '\n' ' ')
PR_NUMBERS=$(echo "$PR_TITLE_ESCAPED" | grep -oE "#[0-9]+" | tr -d '#' | tr '\n' ' ')
echo "Extracted PR Numbers: $PR_NUMBERS"
# Save PR numbers to a file
echo "$PR_NUMBERS" > pr_numbers.txt
echo "Saved PR Numbers to pr_numbers.txt"
# Check if the title matches the specific pattern
if echo "$PR_TITLE" | grep -qE "\[Created by @.+ from #[0-9]+\]$"; then
# Check if the title matches a specific pattern
if echo "$PR_TITLE" | grep -qE "^deps: Merge( #[0-9]+)+ PRs into .+"; then
echo "proceed=true" >> $GITHUB_OUTPUT
else
echo "proceed=false" >> $GITHUB_OUTPUT
fi
shell: /usr/bin/bash -e {0}
- name: Use extracted PR numbers and label PRs
if: (steps.extract_pr_numbers.outputs.proceed == 'true' || contains(github.event.pull_request.labels.*.name, 'milestone-merge')) && github.event.pull_request.merged == true
Expand All @@ -58,7 +59,6 @@ jobs:

- name: Delete branch after PR close
if: steps.extract_pr_numbers.outputs.proceed == 'true' || contains(github.event.pull_request.labels.*.name, 'milestone-merge')
continue-on-error: true
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
echo "Branch to delete: $BRANCH_NAME"
Expand Down

0 comments on commit 666b7f8

Please sign in to comment.