Skip to content

Commit cdebbd8

Browse files
authored
Avoid using commit-headless to push a branch with no commits (#9837)
1 parent 4c89f79 commit cdebbd8

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

.github/workflows/create-release-branch.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
create-release-branch:
1616
runs-on: ubuntu-latest
1717
permissions:
18-
contents: read
18+
contents: write # Allow pushing the empty release branch
1919
id-token: write # Required for OIDC token federation
2020
steps:
2121
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
@@ -45,8 +45,10 @@ jobs:
4545
BRANCH="release/${TAG%.0}.x"
4646
echo "branch=${BRANCH}" >> "$GITHUB_OUTPUT"
4747
48-
- name: Checkout dd-trace-java
48+
- name: Checkout dd-trace-java at tag
4949
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
50+
with:
51+
ref: ${{ github.sha }}
5052

5153
- name: Check if branch already exists
5254
id: check-branch
@@ -60,15 +62,11 @@ jobs:
6062
echo "Branch $BRANCH does not exist - proceeding with following steps"
6163
fi
6264
63-
- name: Push empty release branch
65+
- name: Create and push empty release branch
6466
if: steps.check-branch.outputs.creating_new_branch == 'true'
65-
uses: DataDog/commit-headless@5a0f3876e0fbdd3a86b3e008acf4ec562db59eee # action/v2.0.1
66-
with:
67-
token: "${{ steps.octo-sts.outputs.token }}"
68-
branch: "${{ steps.define-branch.outputs.branch }}"
69-
head-sha: "${{ github.sha }}"
70-
create-branch: true
71-
command: push
67+
run: |
68+
git checkout -b "${{ steps.define-branch.outputs.branch }}"
69+
git push -u origin "${{ steps.define-branch.outputs.branch }}"
7270
7371
- name: Define temp branch name
7472
if: steps.check-branch.outputs.creating_new_branch == 'true'

0 commit comments

Comments
 (0)