Skip to content

[WIP] CI: handle required workflows when skipped #50

[WIP] CI: handle required workflows when skipped

[WIP] CI: handle required workflows when skipped #50

Workflow file for this run

name: PR analysis
on:
workflow_call:
outputs:
skip: { type: boolean, description: "Whether to skip dependent CI checks" }

Check failure on line 6 in .github/workflows/check_diff.yml

View workflow run for this annotation

GitHub Actions / PR analysis

Invalid workflow file

The workflow is not valid. .github/workflows/check_diff.yml (Line: 6, Col: 15): Unexpected value 'type' .github/workflows/check_diff.yml (Line: 6, Col: 13): Required property is missing: value
pull_request:
concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}-checkdiff
cancel-in-progress: true
jobs:
check_diff:
name: Check files changed
runs-on: ubuntu-20.04
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add forked repository as remote
run: |
git remote add fork ${{ github.event.pull_request.head.repo.clone_url }}
- name: Fetch base branch from main repository
run: |
git fetch origin ${BASE_REF}
- name: Fetch head branch from forked repository
run: |
git fetch fork ${HEAD_REF}
- name: Get files changed
run: |
git diff --name-only --diff-filter=ACMRTUXB origin/${BASE_REF}..fork/${HEAD_REF} > check_diff.txt
- name: Check files changed
id: check
run: |
if grep -v -E "^(Docs|\.github)/|\.azure-pipelines\.yml$" check_diff.txt; then
echo "skip=false"
echo "skip=false" >> ${GITHUB_OUTPUT}
else
echo "skip=true"
echo "skip=true" >> ${GITHUB_OUTPUT}
fi
echo "GITHUB_OUTPUT = ${GITHUB_OUTPUT}"
outputs:
skip: ${{ steps.check.outputs.skip }}