Skip to content

Commit a011ae4

Browse files
authored
Simplify create-release-branch workflow (#9954)
* Simplify create-release-branch workflow * Checkout release branch at tag * Update name
1 parent 0933194 commit a011ae4

File tree

2 files changed

+20
-84
lines changed

2 files changed

+20
-84
lines changed

.github/chainguard/self.update-system-tests.create-pr.sts.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 20 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create Release Branch and Pin System-Tests
1+
name: Create Release Branch
22

33
on:
44
push:
@@ -15,24 +15,8 @@ jobs:
1515
create-release-branch:
1616
runs-on: ubuntu-latest
1717
permissions:
18-
contents: write # Allow pushing the empty release branch
19-
id-token: write # Required for OIDC token federation
18+
contents: write # Allow pushing the release branch
2019
steps:
21-
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
22-
id: octo-sts
23-
with:
24-
scope: DataDog/dd-trace-java
25-
policy: self.update-system-tests.create-pr
26-
27-
- name: Checkout dd-trace-java master branch
28-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
29-
with:
30-
ref: master
31-
32-
- name: Get head SHA of master branch
33-
id: get-head-sha
34-
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
35-
3620
- name: Determine tag
3721
id: determine-tag
3822
run: |
@@ -53,61 +37,25 @@ jobs:
5337
TAG=${{ steps.determine-tag.outputs.tag }}
5438
echo "branch=release/${TAG%.0}.x" >> "$GITHUB_OUTPUT"
5539
56-
# - name: Check if branch already exists
57-
# id: check-branch
58-
# run: |
59-
# BRANCH=${{ steps.define-branch.outputs.branch }}
60-
# if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
61-
# echo "creating_new_branch=false" >> "$GITHUB_OUTPUT"
62-
# echo "Branch $BRANCH already exists - skipping following steps"
63-
# else
64-
# echo "creating_new_branch=true" >> "$GITHUB_OUTPUT"
65-
# echo "Branch $BRANCH does not exist - proceeding with following steps"
66-
# fi
67-
68-
# - name: Create and push empty release branch
69-
# if: steps.check-branch.outputs.creating_new_branch == 'true'
70-
# run: |
71-
# git checkout -b "${{ steps.define-branch.outputs.branch }}"
72-
# git push -u origin "${{ steps.define-branch.outputs.branch }}"
73-
74-
- name: Update system-tests references to latest commit SHA on main
75-
# if: steps.check-branch.outputs.creating_new_branch == 'true'
76-
run: BRANCH=main ./tooling/update_system_test_reference.sh
77-
78-
- name: Define temp branch name
79-
# if: steps.check-branch.outputs.creating_new_branch == 'true'
80-
id: define-temp-branch
81-
run: echo "temp-branch=ci/pin-system-tests-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
40+
- name: Checkout dd-trace-java at tag
41+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
42+
with:
43+
ref: ${{ steps.determine-tag.outputs.tag }}
8244

83-
- name: Commit changes
84-
# if: steps.check-branch.outputs.creating_new_branch == 'true'
85-
id: create-commit
45+
- name: Check if branch already exists
46+
id: check-branch
8647
run: |
87-
git config user.name "github-actions[bot]"
88-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
89-
git commit -m "chore: Pin system-tests for release branch" .github/workflows/run-system-tests.yaml
90-
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
91-
92-
- name: Push changes to temp branch
93-
# if: steps.check-branch.outputs.creating_new_branch == 'true'
94-
uses: DataDog/commit-headless@5a0f3876e0fbdd3a86b3e008acf4ec562db59eee # action/v2.0.1
95-
with:
96-
token: "${{ steps.octo-sts.outputs.token }}"
97-
branch: "${{ steps.define-temp-branch.outputs.temp-branch }}"
98-
head-sha: "${{ steps.get-head-sha.outputs.sha }}"
99-
create-branch: true
100-
command: push
101-
commits: "${{ steps.create-commit.outputs.commit }}"
48+
BRANCH=${{ steps.define-branch.outputs.branch }}
49+
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
50+
echo "creating_new_branch=false" >> "$GITHUB_OUTPUT"
51+
echo "Branch $BRANCH already exists - skipping creation"
52+
else
53+
echo "creating_new_branch=true" >> "$GITHUB_OUTPUT"
54+
echo "Branch $BRANCH does not exist - creating it now"
55+
fi
10256
103-
- name: Create pull request from temp branch to release branch
104-
# if: steps.check-branch.outputs.creating_new_branch == 'true'
105-
env:
106-
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
57+
- name: Create and push release branch
58+
if: steps.check-branch.outputs.creating_new_branch == 'true'
10759
run: |
108-
gh pr create --title "Pin system-tests for ${{ steps.define-branch.outputs.branch }}" \
109-
--base "${{ steps.define-branch.outputs.branch }}" \
110-
--head "${{ steps.define-temp-branch.outputs.temp-branch }}" \
111-
--label "tag: dependencies" \
112-
--label "tag: no release notes" \
113-
--body "This PR pins the system-tests reference for the release branch."
60+
git checkout -b "${{ steps.define-branch.outputs.branch }}"
61+
git push -u origin "${{ steps.define-branch.outputs.branch }}"

0 commit comments

Comments
 (0)