ci: consolidate preflight check #6
1 changed files with 12 additions and 14 deletions
26
.github/workflows/ci.yml
vendored
26
.github/workflows/ci.yml
vendored
|
@ -14,18 +14,25 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Preflight checks
|
name: Preflight checks
|
||||||
outputs:
|
outputs:
|
||||||
be_changed: ${{ steps.be-changes.outputs.be_changed }}
|
be_changed: ${{ steps.change-check.outputs.be_changed }}
|
||||||
fe_changed: ${{ steps.fe-changes.outputs.fe_changed }}
|
fe_changed: ${{ steps.change-check.outputs.fe_changed }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Change check (frontend)
|
- name: Change check
|
||||||
id: fe-changes
|
id: change-check
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.ref }}" == "refs/heads/main" ] | [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./.github)" ]
|
if [ "${{ github.ref }}" == "refs/heads/main" ]
|
||||||
then
|
then
|
||||||
echo "fe_changed=true" >> "$GITHUB_OUTPUT"
|
echo "fe_changed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "be_changed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./.github)" ]
|
||||||
|
then
|
||||||
|
echo "fe_changed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "be_changed=true" >> "$GITHUB_OUTPUT"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./frontend
|
git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./frontend
|
||||||
|
@ -33,15 +40,6 @@ jobs:
|
||||||
then
|
then
|
||||||
echo "fe_changed=true" >> "$GITHUB_OUTPUT"
|
echo "fe_changed=true" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
- name: Change check (backend)
|
|
||||||
id: be-changes
|
|
||||||
run: |
|
|
||||||
if [ "${{ github.ref }}" == "refs/heads/main" ] | [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./.github)" ]
|
|
||||||
then
|
|
||||||
echo "be_changed=true" >> "$GITHUB_OUTPUT"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./backend
|
|
||||||
if [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./backend)" ]
|
if [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./backend)" ]
|
||||||
then
|
then
|
||||||
echo "be_changed=true" >> "$GITHUB_OUTPUT"
|
echo "be_changed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
|
Reference in a new issue