fix: return correct id for article creation response #1002
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Quality | |
on: | |
pull_request_target: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set unique container name | |
id: container_name | |
run: echo "CONTAINER_NAME=postgres_${{ github.run_id }}_${{ github.job }}" >> $GITHUB_ENV | |
- name: Start PostgreSQL container | |
run: | | |
docker run -d --name $CONTAINER_NAME \ | |
-e POSTGRES_DB=postgres \ | |
-e POSTGRES_USER=postgres \ | |
-e POSTGRES_PASSWORD=postgres \ | |
-p 0:5432 postgres:latest | |
# Extract the dynamically assigned port | |
POSTGRES_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "5432/tcp") 0).HostPort}}' $CONTAINER_NAME) | |
# Export the port to the environment | |
echo "POSTGRES_PORT=$POSTGRES_PORT" >> $GITHUB_ENV | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up PHP | |
uses: nanasess/setup-php@v4 | |
with: | |
php-version: '8.2' | |
extensions: pgsql, pdo_pgsql, zip, bcmath, apcu | |
ini-values: | | |
apc.enabled=1 | |
apc.enable_cli=1 | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-dir)" | |
- name: Cache Composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install PHP dependencies | |
run: composer install --no-interaction --prefer-dist --optimize-autoloader | |
- name: Set environment variables for CI | |
run: | | |
cp .env.example .env | |
echo "APP_KEY=${{ secrets.APP_KEY }}" >> .env | |
echo "DB_CONNECTION=pgsql" >> .env | |
echo "DB_HOST=localhost" >> .env | |
echo "DB_PORT=$POSTGRES_PORT" >> .env | |
echo "DB_DATABASE=postgres" >> .env | |
echo "DB_USERNAME=postgres" >> .env | |
echo "DB_PASSWORD=postgres" >> .env | |
- name: Run database migrations | |
run: php artisan migrate --force | |
- name: Run Laravel tests | |
run: | | |
php artisan jwt:secret | |
php artisan test | |
- name: Stop and remove PostgreSQL container | |
if: always() # Ensures this step runs even if the previous steps fail | |
run: | | |
docker stop $CONTAINER_NAME | |
docker rm $CONTAINER_NAME |