Skip to content

Commit 8f079b0

Browse files
committed
fix sha-automation core
Signed-off-by: emdneto <[email protected]>
1 parent 36007ae commit 8f079b0

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

.github/workflows/backport.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,4 @@ jobs:
4040
gh pr create --title "[$GITHUB_REF_NAME] $title" \
4141
--body "Clean cherry-pick of #$NUMBER to the \`$GITHUB_REF_NAME\` branch." \
4242
--head $branch \
43-
--base $GITHUB_REF_NAME \
44-
--label backport
43+
--base $GITHUB_REF_NAME

.github/workflows/prepare-patch-release.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
run: .github/scripts/use-cla-approved-github-bot.sh
6666

6767
- name: Create pull request
68+
id: create_pr
6869
env:
6970
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
7071
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
@@ -74,8 +75,14 @@ jobs:
7475
7576
git commit -a -m "$message"
7677
git push origin HEAD:$branch
77-
gh pr create --title "[$GITHUB_REF_NAME] $message" \
78+
pr_url=$(gh pr create --title "[$GITHUB_REF_NAME] $message" \
7879
--body "$message." \
7980
--head $branch \
80-
--base $GITHUB_REF_NAME \
81-
--label prepare-release
81+
--base $GITHUB_REF_NAME)
82+
echo "pr_url=$pr_url" >> $GITHUB_OUTPUT
83+
- name: Add prepare-release label to PR
84+
if: steps.create_pr.outputs.pr_url != ''
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
run: |
88+
gh pr edit ${{ steps.create_pr.outputs.pr_url }} --add-label "prepare-release"

.github/workflows/prepare-release-branch.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ jobs:
9191
run: .github/scripts/use-cla-approved-github-bot.sh
9292

9393
- name: Create pull request against the release branch
94+
id: create_release_branch_pr
9495
env:
9596
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
9697
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
@@ -100,11 +101,18 @@ jobs:
100101
101102
git commit -a -m "$message"
102103
git push origin HEAD:$branch
103-
gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
104+
pr_url=$(gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
104105
--body "$message." \
105106
--head $branch \
106-
--base $RELEASE_BRANCH_NAME \
107-
--label prepare-release
107+
--base $RELEASE_BRANCH_NAME)
108+
echo "pr_url=$pr_url" >> $GITHUB_OUTPUT
109+
110+
- name: Add prepare-release label to PR
111+
if: steps.create_release_branch_pr.outputs.pr_url != ''
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
run: |
115+
gh pr edit ${{ steps.create_release_branch_pr.outputs.pr_url }} --add-label "prepare-release"
108116
109117
create-pull-request-against-main:
110118
runs-on: ubuntu-latest
@@ -171,6 +179,7 @@ jobs:
171179
run: .github/scripts/use-cla-approved-github-bot.sh
172180

173181
- name: Create pull request against main
182+
id: create_main_pr
174183
env:
175184
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
176185
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
@@ -181,8 +190,15 @@ jobs:
181190
182191
git commit -a -m "$message"
183192
git push origin HEAD:$branch
184-
gh pr create --title "$message" \
193+
pr_url=$(gh pr create --title "$message" \
185194
--body "$body" \
186195
--head $branch \
187-
--base main \
188-
--label prepare-release
196+
--base main)
197+
echo "pr_url=$pr_url" >> $GITHUB_OUTPUT
198+
199+
- name: Add prepare-release label to PR
200+
if: steps.create_main_pr.outputs.pr_url != ''
201+
env:
202+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
203+
run: |
204+
gh pr edit ${{ steps.create_main_pr.outputs.pr_url }} --add-label "prepare-release"

0 commit comments

Comments
 (0)