Versie die kan bouwen zonder Rijksoverheid intelectual property #30
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: Check for missing migrations | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
sync: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout db | |
uses: actions/checkout@v4 | |
with: | |
repository: minvws/nl-rdo-databases | |
ref: 'main' | |
token: ${{ secrets.repo_read_only_token }} | |
path: './database' | |
- name: check for missing migrations | |
id: migration_check | |
run: | | |
# Run the script and store the output | |
set +e | |
OUT="$(sh .github/scripts/check-missing-migrations.sh)" | |
RETVAL=$? | |
set -e | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64 | tr -dc 'a-zA-Z0-9') | |
{ | |
echo "output<<$EOF" | |
echo "$OUT" | |
echo "$EOF" | |
if [[ $RETVAL -eq 1 ]] ; then | |
echo "missing_migrations=true" | |
else | |
echo "missing_migrations=false" | |
fi | |
} >> "$GITHUB_OUTPUT" | |
- name: debug it | |
run: | | |
echo ${{ steps }} | |
echo $GITHUB_OUTPUT | |
echo $GITHUB_STATE | |
# Find the comment | |
- name: Find Comment | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: Missing Database Migrations | |
# Create a comment when migrations are missing in the db repo | |
- name: Create comment | |
if: contains(steps.migration_check.outputs.missing_migrations, 'true') | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
edit-mode: replace | |
body: | | |
## 🦙🦙 Missing Database Migrations detected | |
``` | |
${{ steps.migration_check.outputs.output }} | |
``` | |
👨💻 Please run `php bin/console woopie:sql:dump` to create the SQL migrations files, and add them to the database repository to get rid of this message. | |
# Remove comment if no missing migrations | |
- if: ${{ contains(steps.git.outputs.missing_migrations, 'false') && steps.fc.outputs.comment-id != '' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.deleteComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: ${{ steps.fc.outputs.comment-id }} | |
}) |