Skip to content

Commit

Permalink
ci: extract rebase PR login into a common command
Browse files Browse the repository at this point in the history
This reduces code duplicatation

(cherry picked from commit 3ea0383)
  • Loading branch information
alan-agius4 authored and clydin committed Jul 18, 2022
1 parent 0b65387 commit e96709e
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions .circleci/dynamic_config.yml
Expand Up @@ -87,6 +87,22 @@ commands:
name: Initialize Environment
command: ./.circleci/env.sh

rebase_pr:
steps:
- run:
name: Rebase PR on target branch
shell: bash
command: >
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
# User is required for rebase.
git config user.name "angular-ci"
git config user.email "angular-ci"
# Rebase PR on top of target branch.
node tools/rebase-pr.js angular/angular-cli ${CIRCLE_PR_NUMBER}
else
echo "This build is not over a PR, nothing to do."
fi
custom_attach_workspace:
description: Attach workspace at a predefined location
steps:
Expand Down Expand Up @@ -145,18 +161,7 @@ jobs:
resource_class: medium
steps:
- checkout
- run:
name: Rebase PR on target branch
command: >
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
# User is required for rebase.
git config user.name "angular-ci"
git config user.email "angular-ci"
# Rebase PR on top of target branch.
node tools/rebase-pr.js angular/angular-cli ${CIRCLE_PR_NUMBER}
else
echo "This build is not over a PR, nothing to do."
fi
- rebase_pr
- initialize_env
- restore_cache:
keys:
Expand Down Expand Up @@ -309,18 +314,7 @@ jobs:
parallelism: 8
steps:
- checkout
- run:
name: Rebase PR on target branch
command: |
if (Test-Path env:CIRCLE_PR_NUMBER) {
# User is required for rebase.
git config user.name "angular-ci"
git config user.email "angular-ci"
# Rebase PR on top of target branch.
node tools/rebase-pr.js angular/angular-cli $env:CIRCLE_PR_NUMBER
} else {
echo "This build is not over a PR, nothing to do."
}
- rebase_pr
- setup_windows
- restore_cache:
keys:
Expand Down

0 comments on commit e96709e

Please sign in to comment.