ci: consolidate preflight check (#6)
This commit is contained in:
parent
699007bae9
commit
2003c1df35
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
|
||||
name: Preflight checks
|
||||
outputs:
|
||||
be_changed: ${{ steps.be-changes.outputs.be_changed }}
|
||||
fe_changed: ${{ steps.fe-changes.outputs.fe_changed }}
|
||||
be_changed: ${{ steps.change-check.outputs.be_changed }}
|
||||
fe_changed: ${{ steps.change-check.outputs.fe_changed }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Change check (frontend)
|
||||
id: fe-changes
|
||||
- name: Change check
|
||||
id: change-check
|
||||
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
|
||||
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
|
||||
fi
|
||||
git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./frontend
|
||||
|
@ -33,15 +40,6 @@ jobs:
|
|||
then
|
||||
echo "fe_changed=true" >> "$GITHUB_OUTPUT"
|
||||
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)" ]
|
||||
then
|
||||
echo "be_changed=true" >> "$GITHUB_OUTPUT"
|
||||
|
|
Reference in a new issue