Skip to content

Commit aeb02b5

Browse files
committed
Add temp debugging for dry run
1 parent d1cb1df commit aeb02b5

File tree

1 file changed

+58
-6
lines changed

1 file changed

+58
-6
lines changed

.circleci/config.yml

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,62 @@ jobs:
136136
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
137137
sudo apt update
138138
sudo apt install gh -y
139+
# Add debugging step before the main step
139140
- run:
140-
name: Create PR
141+
name: Debug Environment
142+
command: |
143+
set -x
144+
echo "=== Checking Environment Variables ==="
145+
if [ -n "$GH_TOKEN" ]; then echo "GH_TOKEN exists"; else echo "GH_TOKEN is missing"; fi
146+
if [ -n "$DRY_RUN" ]; then echo "DRY_RUN value: $DRY_RUN"; else echo "DRY_RUN is missing"; fi
147+
148+
echo "=== Checking GitHub CLI ==="
149+
gh --version
150+
151+
echo "=== Checking Files ==="
152+
ls -la
153+
154+
echo "=== Checking scripts directory ==="
155+
ls -la scripts/ || echo "scripts directory does not exist"
156+
157+
echo "=== Checking common.sh ==="
158+
cat scripts/common.sh || echo "common.sh not found"
159+
# Break down the PR creation into smaller steps
160+
- run:
161+
name: Prepare Git Config
162+
command: |
163+
set -x
164+
# Set up git config
165+
git config --global user.email "[email protected]"
166+
git config --global user.name "Cloudsmith Bot"
167+
echo "Git configuration:"
168+
git config --global --list
169+
- run:
170+
name: Extract Package Version
141171
command: |
172+
set -x
142173
# Get API version from common.sh
174+
echo "Trying to extract package_version from scripts/common.sh"
175+
cat scripts/common.sh | grep "package_version"
143176
PACKAGE_VERSION=$(grep -oP 'package_version=\K[^"]+' scripts/common.sh)
177+
echo "Found package_version: $PACKAGE_VERSION"
178+
- run:
179+
name: Check for Changes
180+
command: |
181+
set -x
182+
# Check if there are any changes
183+
echo "Git status:"
184+
git status
144185
145-
# Set up git config
146-
git config --global user.email "${{ secrets.GH_USER_EMAIL }}"
147-
git config --global user.name "${{ secrets.GH_USER }}"
186+
echo "Git diff:"
187+
git diff --stat
188+
- run:
189+
name: Create PR
190+
command: |
191+
set -x
192+
# Get API version from common.sh
193+
PACKAGE_VERSION=$(grep -oP 'package_version=\K[^"]+' scripts/common.sh)
194+
echo "Found package_version: $PACKAGE_VERSION"
148195
149196
# Check for dry run mode
150197
if [ "${DRY_RUN}" == "true" ]; then
@@ -160,6 +207,7 @@ jobs:
160207
161208
# Create branch
162209
BRANCH_NAME="update-api-bindings-v${PACKAGE_VERSION}"
210+
echo "Creating branch: $BRANCH_NAME"
163211
git checkout -b ${BRANCH_NAME}
164212
165213
# Check if there are changes to commit
@@ -169,18 +217,22 @@ jobs:
169217
fi
170218
171219
# Commit changes
220+
echo "Committing changes"
172221
git add .
173222
git commit -m "Update API bindings to version ${PACKAGE_VERSION}"
174223
175224
# Push to remote
225+
echo "Pushing to remote"
176226
git push origin ${BRANCH_NAME}
177227
178228
# Create PR
179-
gh pr create --title "Update API bindings to version ${PACKAGE_VERSION}" --body "This PR updates the API bindings to version ${PACKAGE_VERSION}." --repo https://github.com/cloudsmith-io/cloudsmith-api
229+
echo "Creating PR"
230+
GH_DEBUG=1 gh pr create --title "Update API bindings to version ${PACKAGE_VERSION}" --body "This PR updates the API bindings to version ${PACKAGE_VERSION}." --repo https://github.com/cloudsmith-io/cloudsmith-api
180231
environment:
181-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
232+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
182233
DRY_RUN: << pipeline.parameters.dry-run >>
183234

235+
184236
workflows:
185237
version: 2
186238
test_and_deploy:

0 commit comments

Comments
 (0)