Skip to content

Pull Request Checks #338

Pull Request Checks

Pull Request Checks #338

Workflow file for this run

name: Pull Request Checks
on:
merge_group:
branches: [main]
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
changes:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
outputs:
is-bot: ${{ steps.check-author.outputs.is_bot }}
is-cfc: ${{ steps.check-cfc.outputs.is_cfc }}
is-page: ${{ steps.check-page.outputs.is_page }}
is-skip: ${{ steps.check-skip.outputs.is_skip }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
- name: Check last commit author
id: check-author
run: |
lastauthor=$(git log -n 1 --pretty=format:%al ${{ github.event.pull_request.head.sha }})
if [[ $lastauthor == 'github-actions[bot]' ]]; then
echo "is_bot=true" >> $GITHUB_OUTPUT
fi
- name: Check for new under consideration files
id: check-cfc
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ $file == *"data/file_features/under_consideration/"* ]]; then
echo "is_cfc=true" >> $GITHUB_OUTPUT
break
fi
done
- name: Check for changes to the page
id: check-page
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ $file == *"conformance-search/"* ]]; then
echo "is_page=true" >> $GITHUB_OUTPUT
break
fi
done
- name: Check if action is label but it is unrelated
id: check-skip
run: |
if [[ '${{ github.event.action }}' == 'labeled' ]]; then
if [[ '${{ github.event.label.name }}' != 'conformance-file' ]]; then
echo "is_skip=true" >> $GITHUB_OUTPUT
fi
fi
cfc:
needs: changes
if: |
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'conformance-file') &&
needs.changes.outputs.is-cfc == 'true' &&
needs.changes.outputs.is-bot != 'true' &&
needs.changes.outputs.is-skip != 'true'
uses: ./.github/workflows/cfc.yml
secrets: inherit
test:
needs: [changes, cfc]
if: |
always() &&
(needs.cfc.result == 'success' || needs.cfc.result == 'skipped') &&
needs.cfc.outputs.created != 'true'
uses: ./.github/workflows/test.yml
with:
test-page: ${{ github.event_name != 'pull_request' || needs.changes.outputs.is-page == 'true' }}