Skip to content

Commit a706505

Browse files
committed
build: checkout branch before moving artifacts
1 parent d940344 commit a706505

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

.github/workflows/run_tests_coverage.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,19 @@
227227

228228
# Token for accessing the repository:
229229
token: ${{ secrets.REPO_GITHUB_TOKEN }}
230+
231+
# Checkout coverage repository branch:
232+
- name: 'Checkout coverage repository branch'
233+
run: |
234+
cd ./www-test-code-coverage
235+
236+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
237+
BRANCH_NAME="pr-${{ github.event.pull_request.number }}"
238+
git fetch origin $BRANCH_NAME || true
239+
git checkout $BRANCH_NAME || git checkout -b $BRANCH_NAME
240+
else
241+
BRANCH_NAME="main"
242+
fi
230243
231244
# Copy artifacts to the repository:
232245
- name: 'Copy artifacts to the repository'
@@ -239,19 +252,9 @@
239252
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
240253
USER_NAME: stdlib-bot
241254
run: |
242-
cd ./www-test-code-coverage
243-
244-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
245-
BRANCH_NAME="pr-${{ github.event.pull_request.number }}"
246-
git fetch origin $BRANCH_NAME || true
247-
git checkout $BRANCH_NAME || git checkout -b $BRANCH_NAME
248-
else
249-
BRANCH_NAME="main"
250-
fi
251-
252-
git add .
253255
git config --local user.email "noreply@stdlib.io"
254256
git config --local user.name "stdlib-bot"
257+
git add .
255258
git commit -m "Update artifacts"
256259
git push "https://$USER_NAME:$REPO_GITHUB_TOKEN@github.com/stdlib-js/www-test-code-coverage.git" $BRANCH_NAME
257260

0 commit comments

Comments
 (0)