Skip to content

Commit 92d5662

Browse files
Update template_update.yml
1 parent 59eb2dc commit 92d5662

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

.github/workflows/template_update.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ jobs:
108108
- name: Create template branch and merge
109109
id: merge
110110
shell: bash
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111113
run: |
112114
set -euo pipefail
113115
@@ -119,9 +121,11 @@ jobs:
119121
git config user.name "GitHub Actions Bot"
120122
git config user.email "actions@github.com"
121123
122-
# Save current branch name and remote URL
124+
# Configure git to use the token for authentication
125+
git config url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
126+
127+
# Save current branch name
123128
CURRENT_BRANCH="${{ inputs.repo_branch }}"
124-
REMOTE_URL=$(git remote get-url origin)
125129
126130
# Create an orphan branch with the rendered template content
127131
git checkout --orphan template-rendered
@@ -146,11 +150,6 @@ jobs:
146150
git checkout "${CURRENT_BRANCH}"
147151
git checkout -b "$BRANCH"
148152
149-
# Ensure remote is configured (may have been lost during orphan branch operations)
150-
if ! git remote get-url origin >/dev/null 2>&1; then
151-
git remote add origin "$REMOTE_URL"
152-
fi
153-
154153
# Merge using the commit SHA instead of branch name
155154
if git merge "$TEMPLATE_COMMIT" --allow-unrelated-histories --no-edit -m "chore: update from template ${OLD_SHA} → ${NEW_SHA}"; then
156155
echo "merge_had_conflicts=false" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)