Skip to content

Commit 5981752

Browse files
authored
fix(root): gh action strategy for pr creation (#9006)
1 parent cbf78a3 commit 5981752

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

.github/workflows/release-packages.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,42 @@ jobs:
9999
run: pnpm run build:packages
100100

101101
- name: Publish packages (nightly only)
102-
if: ${{ github.event.inputs.nightly }}
103102
env:
104103
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
105104
run: |
106-
export NX_RELEASE_TAG=nightly
107-
pnpm nx run-many -t nx-release-publish --projects=${{ github.event.inputs.packages }}
105+
if [ "${{ github.event.inputs.nightly }}" = "true" ]; then
106+
export NX_RELEASE_TAG=nightly
107+
pnpm nx run-many -t nx-release-publish --projects=${{ github.event.inputs.packages }}
108+
else
109+
echo "Skipping publish for non-nightly release"
110+
fi
111+
112+
- name: Debug git status
113+
run: |
114+
echo "=== Git Status ==="
115+
git status
116+
echo "=== Git Log (last 3 commits) ==="
117+
git log --oneline -3
118+
echo "=== Changed Files ==="
119+
git diff --name-only HEAD~1 || echo "No commits to compare against"
120+
121+
- name: Reset to clean state for PR creation
122+
run: |
123+
echo "=== Resetting any commits made by NX ==="
124+
# If NX created commits, reset to the original commit but keep changes
125+
if [ "$(git log --oneline HEAD~1..HEAD | wc -l)" -gt "0" ]; then
126+
echo "Found $(git log --oneline HEAD~1..HEAD | wc -l) commits since start"
127+
git reset --soft HEAD~$(git log --oneline HEAD~1..HEAD | wc -l)
128+
echo "Reset commits, changes are now staged"
129+
git status
130+
else
131+
echo "No commits to reset"
132+
# Stage any unstaged changes
133+
git add -A
134+
fi
108135
109136
- name: Create Pull Request
110137
id: create-pr
111-
if: ${{ !github.event.inputs.nightly }}
112138
uses: peter-evans/create-pull-request@v5
113139
with:
114140
token: ${{ secrets.GITHUB_TOKEN }}
@@ -127,11 +153,12 @@ jobs:
127153
### 🔄 Changes:
128154
- Updated package versions to ${{ github.event.inputs.version }}
129155
- Generated changelogs from ${{ github.event.inputs.previous_tag }}
130-
- Built and published packages to NPM
156+
- Built packages for release
131157
132158
**Please review the changes and merge when ready for the release to be tagged and GitHub releases to be created.**
133159
branch: release-${{ github.event.inputs.version }}
134160
base: next
161+
delete-branch: false
135162

136163
post_release:
137164
needs: release

0 commit comments

Comments
 (0)