Skip to content

chore(RSS-ECOMM-1_32): set up GitHub actions CI pipeline #26

chore(RSS-ECOMM-1_32): set up GitHub actions CI pipeline

chore(RSS-ECOMM-1_32): set up GitHub actions CI pipeline #26

Workflow file for this run

name: Continuous Integration
on:
pull_request:
branches:
- develop
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Format code with Prettier
run: npm run ci:format
automate-review:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Get PR Author
id: pr_author
run: echo "::set-output name=author::${{ github.event.pull_request.user.login }}"
- name: Debug PR Author
run: |
echo "PR Author: ${{ steps.pr_author.outputs.author }}"
- name: Select First Reviewer
id: select_first_reviewer
if: github.actor != steps.pr_author.outputs.author # Exclude the author
run: |
author="${{ steps.pr_author.outputs.author }}"
all_users=("stardustmeg" "Kleostro" "YulikK")
# Exclude the PR author from the list of potential reviewers
potential_reviewers=()
for user in "${all_users[@]}"; do
if [[ "$user" != "$author" ]]; then
potential_reviewers+=("$user")
fi
done
echo "Potential Reviewers: ${potential_reviewers[@]}"
# Select the first reviewer from the potential reviewers list
first_reviewer="${potential_reviewers[0]}"
echo "::set-output name=first_reviewer::${first_reviewer}"
- name: Debug First Reviewer
run: |
echo "First Reviewer: ${{ steps.select_first_reviewer.outputs.first_reviewer }}"
- name: Select Second Reviewer
id: select_second_reviewer
if: github.actor != steps.pr_author.outputs.author # Exclude the author
run: |
author="${{ steps.pr_author.outputs.author }}"
all_users=("stardustmeg" "Kleostro" "YulikK")
# Exclude the PR author and the first reviewer from the list of potential reviewers
potential_reviewers=()
for user in "${all_users[@]}"; do
if [[ "$user" != "$author" && "$user" != "${{ steps.select_first_reviewer.outputs.first_reviewer }}" ]]; then
potential_reviewers+=("$user")
fi
done
echo "Potential Reviewers: ${potential_reviewers[@]}"
# Select the second reviewer from the potential reviewers list
second_reviewer="${potential_reviewers[0]}"
echo "::set-output name=second_reviewer::${second_reviewer}"
- name: Debug Second Reviewer
run: |
echo "Second Reviewer: ${{ steps.select_second_reviewer.outputs.second_reviewer }}"