Skip to content

update supervosrd.conf #145

update supervosrd.conf

update supervosrd.conf #145

Workflow file for this run

on:
push:
branches:
- "*"
- "!stable"
name: πŸ”₯ Test Workflow
jobs:
laravel-test:
name: πŸ”Ž Laravel Test
runs-on: ubuntu-latest
environment: testing
services:
mariadb:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: testing
MYSQL_DATABASE: testing
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: πŸ™ Git checkout
uses: actions/checkout@v4
- name: πŸ“ Make sure repository is latest
run: git fetch --prune --unshallow
- name: πŸ“‘ Set up php
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
- name: πŸ› οΈ Install dependencies
run: composer install --no-interaction
- name: πŸ“„ Create environment
run: cp .env.example .env
- name: πŸ”‘ Generate app key
run: php artisan key:generate
- name: πŸ’½ Set up database
run: php artisan migrate --seed --env=testing
- name: πŸ—ΊοΈ Check routes
run: php artisan route:clear && php artisan route:list
- name: βœ… Run php tests
run: vendor/bin/phpunit
create-pr:
needs: [laravel-test]
name: πŸ”„ Create Pull Request
runs-on: ubuntu-latest
environment: testing
steps:
- name: πŸ“₯ Checkout code
uses: actions/checkout@v4
- name: πŸš€ Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: πŸš€ Create PR
run: |
# Set up authentication
echo "${{ secrets.PERSONAL_TOKEN }}" >> token.txt
gh auth login --with-token < token.txt
rm -rf token.txt
# Get the current branch name
CURRENT_BRANCH=$(echo "${GITHUB_REF}" | awk -F'/' '{print $3}')
# Check if a pull request already exists
EXISTING_PR=$(gh pr list --state open --base stable --head "${CURRENT_BRANCH}" --json number | jq -r '.[0].number')
# If a pull request exists, exit the workflow
if [[ "$EXISTING_PR" == null ]]; then
# Get the current date and time in the specified format
CURRENT_DATE=$(TZ='Asia/Jakarta' date +'%d-%m-%Y %H:%M')
# Create a pull request with date and time in the title
PR_TITLE="[$CURRENT_DATE] $CURRENT_BRANCH - Request merge $CURRENT_BRANCH to stable branch"
git fetch origin stable
fetch_exit_code=$?
git fetch origin "${CURRENT_BRANCH}"
fetch_branch_exit_code=$?
if [ $fetch_exit_code -ne 0 ]; then
echo "Error fetching 'stable' branch from origin."
exit 0 # Script continues despite the error
fi
if [ $fetch_branch_exit_code -ne 0 ]; then
echo "Error fetching '${CURRENT_BRANCH}' branch from origin."
exit 0 # Script continues despite the error
fi
# Check if the branch exists in the remote repository
if ! git ls-remote --exit-code origin "${CURRENT_BRANCH}"; then
echo "'${CURRENT_BRANCH}' branch does not exist in the remote repository. $?"
fi
if git diff --quiet origin/stable origin/"${CURRENT_BRANCH}"; then
echo "No commits between branches. Skipping pull request creation."
else
gh pr create \
--base stable \
--head "${CURRENT_BRANCH}" \
--title "${PR_TITLE}" \
--body "Automated pull request from ${CURRENT_BRANCH} to stable branch"
fi
else
echo "Pull request ${CURRENT_BRANCH} already exists ${EXISTING_PR}. Skipping PR creation."
exit 0
fi