Skip to content

Commit 34fa22d

Browse files
authored
Chore: pipeline improvemenst (#383)
* fix: fixing empty env var for pipeline * chore: renaming vars to upper snake case * chore: pipeline improvements * fix: adding triggering payload * fix: adding triggering payload
1 parent d244692 commit 34fa22d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.github/workflows/close_pr_on_merged_branch.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,31 @@ jobs:
1313
contents: read
1414
env:
1515
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16-
SOURCE_BRANCH: "${{ github.event.client_payload.SOURCE_BRANCH }}"
16+
SOURCE_BRANCH: "${{ github.event.client_payload.TRIGGERING_PAYLOAD.SOURCE_BRANCH }}"
1717

1818
steps:
19+
- name: Validate source branch
20+
run: |
21+
if [[ -z "$SOURCE_BRANCH" ]]; then
22+
echo "SOURCE_BRANCH is empty or missing – aborting"
23+
exit 1
24+
fi
1925
- name: Skip protected branches
2026
id: check_branch
2127
run: |
2228
if [[ "$SOURCE_BRANCH" == "main" || "$SOURCE_BRANCH" == "release/"* ]]; then
2329
echo "Protected branch $SOURCE_BRANCH – skipping"
2430
echo "skip=true" >> $GITHUB_OUTPUT
31+
else
32+
echo "skip=false" >> $GITHUB_OUTPUT
33+
fi
34+
35+
- name: Check if PR exists
36+
if: steps.check_branch.outputs.skip != 'true'
37+
run: |
38+
if ! gh pr view "$SOURCE_BRANCH" --repo ${{ github.repository }} >/dev/null 2>&1; then
39+
echo "No open PR found for branch $SOURCE_BRANCH – nothing to close"
40+
exit 0
2541
fi
2642
2743
- name: Close PR

0 commit comments

Comments
 (0)