Skip to content

Commit

Permalink
chore: fix workflows (#33457)
Browse files Browse the repository at this point in the history
### Issue # (if applicable)

n/a

### Reason for this change

Checking out the `head.sha` puts us into 'detached HEAD' state

```
You are in 'detached HEAD' state. You can look around, make experimental
  changes and commit them, and you can discard any commits you make in this
  state without impacting any branches by switching back to a branch.
```

so the workflow will fail during the commit/push step:

```
Run git config --global user.name 'aws-cdk-automation'
[detached HEAD 0364b3fc] chore: update analytics metadata blueprints
 3 files changed, 121 insertions(+), 121 deletions(-)
error: src refspec bump/2.179.0 does not match any
error: failed to push some refs to 'https://github.com/aws/aws-cdk'
Error: Process completed with exit code 1.
```

### Description of changes

Checkout the branch head ref just before we commit changes in the workflow.


### Describe any new or updated permissions being added

n/a


### Description of how you validated changes

Tested on release branch, workflow successfully [ran](https://github.com/aws/aws-cdk/actions/workflows/analytics-metadata-updater.yml).

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
gracelu0 authored Feb 15, 2025
1 parent 0e67605 commit 085c2e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/analytics-metadata-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
run: |
git config --global user.name 'aws-cdk-automation'
git config --global user.email '[email protected]'
git checkout -B ${{ github.event.pull_request.head.ref }}
git add .
git commit -m "chore: update analytics metadata blueprints"
git push origin ${{ github.event.pull_request.head.ref }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lambda-runtime-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
run: |
git config --global user.name 'aws-cdk-automation'
git config --global user.email '[email protected]'
git checkout -B ${{ github.event.pull_request.head.ref }}
git add .
git commit -m "chore: update lambda runtime integration tests"
git push origin ${{ github.event.pull_request.head.ref }}
Expand Down

0 comments on commit 085c2e3

Please sign in to comment.