Skip to content

Commit b8d0af8

Browse files
authored
chore(ci): change condition to trigger workflows
1 parent fff4b00 commit b8d0af8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

.github/workflows/merge-release-to-network.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
name: Merge release to network
22

33
on:
4-
push:
4+
pull_request:
55
branches:
6-
- 'release/*'
6+
- release/*
7+
types:
8+
- closed
79

810
env:
911
HEAD_BRANCH: ${{ github.head_ref || github.ref_name }}
10-
12+
RELEASE_BRANCH: ${{ github.event.pull_request.base.ref}}
1113
permissions:
1214
contents: write
1315
pull-requests: write
1416

1517
jobs:
1618
merge-release-to-network:
1719
runs-on: ubuntu-latest
18-
if: ${{ contains(github.head_ref, 'release') }} || ${{ contains(github.ref_name, 'release') }}
20+
if: (github.event.pull_request.merged == true) && (${{ contains(github.head_ref, 'deploy') }})
1921
steps:
2022
- name: Set Env
2123
run: |
2224
echo "PR_BRANCH=merge/${HEAD_BRANCH}" >> $GITHUB_ENV
23-
echo "VERSION=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/release\///' | cut -d'-' -f1)" >> $GITHUB_ENV
24-
echo "NETWORK=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/release\/v[0-9\.]*-\(.*\)/\1/')" >> $GITHUB_ENV
25+
echo "VERSION=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/deploy\///' | cut -d'-' -f1)" >> $GITHUB_ENV
26+
echo "NETWORK=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/deploy\/v[0-9\.]*-\(.*\)/\1/')" >> $GITHUB_ENV
2527
2628
- name: Set Mainnet Tag
2729
if: ${{ env.NETWORK == 'mainnet' }}
@@ -51,7 +53,7 @@ jobs:
5153
delete-branch: true
5254
title: 'chore(`${{ env.NETWORK }}`): merge from `${{ env.HEAD_BRANCH}}`'
5355
body: ${{ steps.template.outputs.result }}
54-
branch: ${{env.PR_BRANCH}}
56+
branch: ${{ env.PR_BRANCH }}
5557

5658
- name: Auto Merge
5759
id: automerge

0 commit comments

Comments
 (0)