Skip to content

Update SQLX files after \#2897 changes #26

Update SQLX files after \#2897 changes

Update SQLX files after \#2897 changes #26

on:
pull_request_target:
branches:
- master
types: [closed]
env:
RUST_BACKTRACE: 1
RUST_CACHE_KEY: rust-cache-20241114
DOCSRS_PREFIX: ignored/cratesfyi-prefix
DOCSRS_DATABASE_URL: postgresql://cratesfyi:password@localhost:15432
DOCSRS_LOG: docs_rs=debug,rustwide=info
AWS_ACCESS_KEY_ID: cratesfyi
AWS_SECRET_ACCESS_KEY: secret_key
S3_ENDPOINT: http://localhost:9000
DOCSRS_INCLUDE_DEFAULT_TARGETS: false
DOCSRS_DOCKER_IMAGE: ghcr.io/rust-lang/crates-build-env/linux-micro
SENTRY_ENVIRONMENT: dev
permissions:
contents: write
pull-requests: write
jobs:
commit-sqlx-changes:
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-latest
outputs:
need_pr: ${{ steps.sqlx_check.outputs.need_pr }}
steps:
- uses: actions/checkout@v5
- name: install `just`
run: sudo snap install --edge --classic just
- name: restore build & cargo cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ env.RUST_CACHE_KEY }}
- name: Launch postgres
run: |
cp .env.sample .env
mkdir -p ${DOCSRS_PREFIX}/public-html
docker compose up -d db s3
# Give the database enough time to start up
sleep 5
# Make sure the database is actually working
psql "${DOCSRS_DATABASE_URL}"
- name: install SQLX CLI
run: cargo install sqlx-cli --no-default-features --features postgres
- name: run database migrations
run: cargo sqlx migrate run --database-url $DOCSRS_DATABASE_URL
- name: Commit sqlx changes on master branch if any
id: sqlx_check
run: |
just sqlx-prepare
# If there are differences in the SQLX files, then we push them on the master branch
if git status --porcelain .sqlx ; then
echo "need_pr=1" >> "$GITHUB_OUTPUT"
else
echo "need_pr=0" >> "$GITHUB_OUTPUT"
fi
- name: Clean up the database
run: docker compose down --volumes
- name: Open pull request
if: ${{ steps.sqlx_check.outputs.need_pr == '1' }}
uses: peter-evans/create-pull-request@v7
with:
commit-message: Update SQLX files
committer: Docs.rs developers <[email protected]>
author: Docs.rs developers <[email protected]>
signoff: false
delete-branch: true
branch: update-sqlx-pr-${{ github.event.pull_request.number }}
title: Update SQLX files after \#${{ github.event.pull_request.number }} changes
body: |
Following #${{ github.event.pull_request.number }} changes, here are the related SQLX files changes.