Skip to content

Commit 31a9ba2

Browse files
sarahsCopilot
andauthored
Improve content pipelines workflow (#60068)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 2918266 commit 31a9ba2

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

.github/workflows/content-pipelines.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ jobs:
6262
echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
6363
6464
- name: Setup branch
65+
id: setup-branch
6566
env:
6667
UPDATE_BRANCH: ${{ steps.branch.outputs.update_branch }}
68+
PR_NUMBER: ${{ steps.check-pr.outputs.pr_number }}
6769
run: |
6870
git config user.name "github-actions[bot]"
6971
git config user.email "github-actions[bot]@users.noreply.github.com"
@@ -76,7 +78,12 @@ jobs:
7678
git merge --abort 2>/dev/null || true
7779
git checkout main
7880
git branch -D "$UPDATE_BRANCH"
79-
git push origin --delete "$UPDATE_BRANCH" || true
81+
if [ -z "$PR_NUMBER" ]; then
82+
git push origin --delete "$UPDATE_BRANCH" || true
83+
else
84+
echo "Skipping remote branch delete — PR #$PR_NUMBER is open"
85+
echo "force_push=true" >> "$GITHUB_OUTPUT"
86+
fi
8087
git checkout -b "$UPDATE_BRANCH"
8188
}
8289
else
@@ -111,12 +118,19 @@ jobs:
111118
if: steps.commit.outputs.has_changes == 'true'
112119
env:
113120
UPDATE_BRANCH: ${{ steps.branch.outputs.update_branch }}
114-
run: git push origin "$UPDATE_BRANCH"
121+
FORCE_PUSH: ${{ steps.setup-branch.outputs.force_push }}
122+
run: |
123+
if [ "$FORCE_PUSH" = "true" ]; then
124+
echo "Force-pushing to align branch after merge conflict reset"
125+
git push --force-with-lease origin "$UPDATE_BRANCH"
126+
else
127+
git push origin "$UPDATE_BRANCH"
128+
fi
115129
116130
- name: Create or update PR
117131
if: steps.commit.outputs.has_changes == 'true'
118132
env:
119-
GH_TOKEN: ${{ github.token }}
133+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
120134
UPDATE_BRANCH: ${{ steps.branch.outputs.update_branch }}
121135
PIPELINE_ID: ${{ matrix.id }}
122136
run: |
@@ -136,15 +150,16 @@ jobs:
136150
137151
if [ -n "$PR_NUMBER" ]; then
138152
echo "PR #$PR_NUMBER already exists — new commit pushed"
153+
echo "Ensuring PR #$PR_NUMBER is marked ready for review"
154+
gh pr ready "$PR_NUMBER" || echo "Unable to mark PR #$PR_NUMBER as ready (it may already be ready)"
139155
else
140156
echo "Creating new PR"
141157
gh pr create \
142158
--title "$PR_TITLE" \
143159
--body "$PR_BODY" \
144160
--base main \
145161
--head "$UPDATE_BRANCH" \
146-
--label "workflow-generated,content-pipeline-update" \
147-
--draft
162+
--label "workflow-generated,content-pipeline-update,ready-for-doc-review"
148163
fi
149164
150165
- uses: ./.github/actions/slack-alert

0 commit comments

Comments
 (0)