ci: alteration compatibility test #9
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
# This integration test ci job is used to test the DB alterations compatibility with the current codebase. | |
name: Alteration Compatibility Test | |
on: | |
push: | |
branches: | |
- master | |
- "push-action/**" | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
check-alteration-changes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout head | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# compare the current codebase with HEAD and check if there are any changes under the alterations folder | |
- name: Check for alteration changes | |
id: alteration-changes | |
run: | | |
CHANGE_FILES=$(git diff --name-only HEAD...${{ github.base_ref }} | grep 'packages/schemas/alterations/*') | |
if [ -z "$CHANGE_FILES" ]; then | |
echo "No alteration changes detected" | |
echo "::set-output name=has-alteration-changes::false" | |
else | |
echo "Alteration changes detected" | |
echo "$CHANGE_FILES" | |
echo "::set-output name=has-alteration-changes::true" | |
fi | |
package: | |
needs: check-alteration-changes | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout base | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.base_ref }} | |
- name: checkout head | |
run: echo ${{needs.check-alteration-changes.outputs.has-alteration-changes == 'true'}} |