Skip to content

Commit 5422f0c

Browse files
committed
Add error statements and exit on errors
1 parent 197f7e9 commit 5422f0c

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
permissions:
1919
contents: write
20-
id-token: write # Required for OIDC token federation
20+
id-token: write # required for OIDC token federation
2121
steps:
2222
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
2323
id: octo-sts
@@ -49,11 +49,10 @@ jobs:
4949
run: |
5050
BRANCH=${{ steps.define-branch.outputs.branch }}
5151
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
52-
echo "creating_new_branch=false" >> "$GITHUB_OUTPUT"
53-
echo "Branch $BRANCH already exists - please delete it and re-run the workflow."
52+
echo "ERROR: Branch $BRANCH already exists - please delete it and re-run the workflow."
53+
exit 1
5454
else
55-
echo "creating_new_branch=true" >> "$GITHUB_OUTPUT"
56-
echo "Branch $BRANCH does not exist - creating it now"
55+
echo "Branch $BRANCH does not exist - creating it now."
5756
fi
5857
5958
- name: Update system-tests references to latest commit SHA on main
@@ -63,16 +62,14 @@ jobs:
6362
id: check-changes
6463
run: |
6564
if [[ -z "$(git status -s)" ]]; then
66-
echo "No changes to commit, exiting."
67-
echo "commit_changes=false" >> "$GITHUB_OUTPUT"
65+
echo "ERROR: No changes to commit - the system-tests reference was not updated."
66+
exit 1
6867
else
69-
echo "commit_changes=true" >> "$GITHUB_OUTPUT"
7068
echo "Changes to commit:"
7169
git status -s
7270
fi
7371
7472
- name: Commit changes
75-
if: steps.check-changes.outputs.commit_changes == 'true'
7673
id: create-commit
7774
run: |
7875
git config user.name "github-actions[bot]"
@@ -82,7 +79,6 @@ jobs:
8279
8380
- name: Push changes
8481
uses: DataDog/commit-headless@5a0f3876e0fbdd3a86b3e008acf4ec562db59eee # action/v2.0.1
85-
if: steps.check-changes.outputs.commit_changes == 'true' && steps.check-branch.outputs.creating_new_branch == 'true'
8682
with:
8783
token: "${{ steps.octo-sts.outputs.token }}"
8884
branch: "${{ steps.define-branch.outputs.branch }}"
@@ -92,7 +88,6 @@ jobs:
9288
commits: "${{ steps.create-commit.outputs.commit }}"
9389

9490
- name: Create pull request
95-
if: steps.check-changes.outputs.commit_changes == 'true' && steps.check-branch.outputs.creating_new_branch == 'true'
9691
env:
9792
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
9893
run: |

0 commit comments

Comments
 (0)