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 3471ac3 commit 57a7a5b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/clean.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@ jobs:
PR_TITLE="${{ github.event.pull_request.title }}"
echo "PR Title: $PR_TITLE"
# Extract PR numbers from the title
PR_NUMBERS=$(echo "$PR_TITLE" | 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 "^deps: Merge( #[0-9]+)+ PRs into .+ \[Created by @.+ from #[0-9]+\]$"; then
if echo "$PR_TITLE" | grep -qE "\[Created by @.+ from #[0-9]+\]$"; 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 @@ -57,6 +58,7 @@ 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 57a7a5b

Please sign in to comment.