codex: refactor pyi parser to ast visitor #6
Workflow file for this run
This file contains hidden or 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
| name: Parser Reference Guard | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled, unlabeled] | |
| jobs: | |
| parser-reference-guard: | |
| if: > | |
| !contains(github.event.pull_request.labels.*.name, 'ignore-parser-reference-guard') && | |
| (github.event.action == 'opened' || | |
| github.event.action == 'synchronize' || | |
| github.event.action == 'reopened' || | |
| github.event.label.name == 'ignore-parser-reference-guard') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify parser implementation reference was updated when needed | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} | |
| run: | | |
| set -euo pipefail | |
| CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA") | |
| echo "Changed files:" | |
| echo "$CHANGED_FILES" | |
| echo "PR labels: ${PR_LABELS:-<none>}" | |
| FORCE_LABEL="require-parser-reference-update" | |
| IGNORE_LABEL="ignore-parser-reference-guard" | |
| if echo ",${PR_LABELS}," | grep -Fq ",${FORCE_LABEL}," && \ | |
| echo ",${PR_LABELS}," | grep -Fq ",${IGNORE_LABEL},"; then | |
| echo "Conflicting labels: ${FORCE_LABEL} and ${IGNORE_LABEL}. Remove one." | |
| exit 1 | |
| fi | |
| if echo ",${PR_LABELS}," | grep -Fq ",${IGNORE_LABEL},"; then | |
| echo "${IGNORE_LABEL} label present; skipping guard." | |
| exit 0 | |
| fi | |
| DOC_CHANGED=false | |
| if echo "$CHANGED_FILES" | grep -Fxq "parser_implementation_reference.md"; then | |
| DOC_CHANGED=true | |
| fi | |
| if echo ",${PR_LABELS}," | grep -Fq ",${FORCE_LABEL},"; then | |
| if [ "$DOC_CHANGED" = true ]; then | |
| echo "${FORCE_LABEL} label present and doc updated." | |
| exit 0 | |
| fi | |
| echo "${FORCE_LABEL} label present, but doc not updated." | |
| exit 1 | |
| fi | |
| if [ "$DOC_CHANGED" = true ]; then | |
| echo "parser_implementation_reference.md changed." | |
| exit 0 | |
| fi | |
| if echo "$CHANGED_FILES" | grep -Eq "^(fortran_parser/|tests/parser/|tests/data/fortran/)"; then | |
| echo "Parser-related files changed without updating parser_implementation_reference.md." | |
| exit 1 | |
| fi | |
| echo "No parser-related files changed; update not required." |