Skip to content

Commit 276a869

Browse files
authored
Clean workflow and trust policy (#10200)
* Clean workflow and trust policy
1 parent d055d92 commit 276a869

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
issuer: https://token.actions.githubusercontent.com
22

3-
subject_pattern: repo:DataDog/dd-trace-java:ref:refs/heads/(master|test/v.+)
3+
subject_pattern: repo:DataDog/dd-trace-java:ref:refs/heads/(master|release/v.+)
44

55
claim_pattern:
66
event_name: (create|workflow_dispatch)
7-
ref: refs/heads/(master|test/v.+)
8-
job_workflow_ref: DataDog/dd-trace-java/\.github/workflows/pin-system-tests\.yaml@refs/heads/(master|test/v.+)
7+
ref: refs/heads/(master|release/v.+)
8+
job_workflow_ref: DataDog/dd-trace-java/\.github/workflows/pin-system-tests\.yaml@refs/heads/(master|release/v.+)
99

1010
permissions:
1111
contents: write

.github/workflows/pin-system-tests.yaml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ on:
1313
jobs:
1414
pin-system-tests:
1515
name: "Pin system tests"
16-
# CHANGE BACK TO release/v*
17-
if: github.event_name != 'create' || startsWith(github.ref, 'refs/heads/test/v')
16+
if: github.event_name != 'create' || startsWith(github.ref, 'refs/heads/release/v')
1817
runs-on: ubuntu-latest
1918
permissions:
20-
contents: write # may not be needed
21-
id-token: write # Required for OIDC token federation
19+
contents: write
20+
id-token: write # required for OIDC token federation
2221
steps:
2322
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
2423
id: octo-sts
@@ -55,11 +54,10 @@ jobs:
5554
run: |
5655
BRANCH=${{ steps.define-branch.outputs.branch }}
5756
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
58-
echo "creating_new_branch=false" >> "$GITHUB_OUTPUT"
59-
echo "Branch $BRANCH already exists - please delete it and re-run the workflow."
57+
echo "ERROR: Branch $BRANCH already exists - please delete it and re-run the workflow."
58+
exit 1
6059
else
61-
echo "creating_new_branch=true" >> "$GITHUB_OUTPUT"
62-
echo "Branch $BRANCH does not exist - creating it now"
60+
echo "Branch $BRANCH does not exist - creating it now."
6361
fi
6462
6563
- name: Update system-tests references to latest commit SHA on main
@@ -69,16 +67,14 @@ jobs:
6967
id: check-changes
7068
run: |
7169
if [[ -z "$(git status -s)" ]]; then
72-
echo "No changes to commit, exiting."
73-
echo "commit_changes=false" >> "$GITHUB_OUTPUT"
70+
echo "ERROR: No changes to commit - the system-tests reference was not updated."
71+
exit 1
7472
else
75-
echo "commit_changes=true" >> "$GITHUB_OUTPUT"
7673
echo "Changes to commit:"
7774
git status -s
7875
fi
7976
8077
- name: Commit changes
81-
if: steps.check-changes.outputs.commit_changes == 'true'
8278
id: create-commit
8379
run: |
8480
git config user.name "github-actions[bot]"
@@ -88,7 +84,6 @@ jobs:
8884
8985
- name: Push changes
9086
uses: DataDog/commit-headless@5a0f3876e0fbdd3a86b3e008acf4ec562db59eee # action/v2.0.1
91-
if: steps.check-changes.outputs.commit_changes == 'true' && steps.check-branch.outputs.creating_new_branch == 'true'
9287
with:
9388
token: "${{ steps.octo-sts.outputs.token }}"
9489
branch: "${{ steps.define-branch.outputs.branch }}"
@@ -98,15 +93,12 @@ jobs:
9893
commits: "${{ steps.create-commit.outputs.commit }}"
9994

10095
- name: Create pull request
101-
if: steps.check-changes.outputs.commit_changes == 'true' && steps.check-branch.outputs.creating_new_branch == 'true'
10296
env:
10397
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
104-
# REMOVE DRAFT
10598
run: |
10699
gh pr create --title "Pin system tests for release branch" \
107100
--base ${{ steps.define-base-branch.outputs.base_branch }} \
108101
--head ${{ steps.define-branch.outputs.branch }} \
109102
--label "tag: dependencies" \
110103
--label "tag: no release notes" \
111104
--body "This PR pins the system-tests reference for the release branch." \
112-
--draft

0 commit comments

Comments
 (0)