Inrix Beta #69
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: lint | |
| on: [pull_request] | |
| jobs: | |
| changelog: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Validate changelog | |
| shell: bash | |
| run: | | |
| # Skip for draft PRs | |
| if [[ "$(jq --raw-output .pull_request.draft ${GITHUB_EVENT_PATH})" == "true" ]]; then | |
| exit 0 | |
| fi | |
| # Get PR info | |
| PR_BASE=$(jq --raw-output .pull_request.base.ref ${GITHUB_EVENT_PATH}) | |
| PR_NUMBER=$(jq --raw-output .pull_request.number ${GITHUB_EVENT_PATH}) | |
| PR_TITLE=$(jq --raw-output .pull_request.title ${GITHUB_EVENT_PATH}) | |
| # Fetch base branch | |
| git fetch origin ${PR_BASE} --depth 1 | |
| # Check changes in CHANGELOG.md or README_RADAR.md | |
| CHANGELOG_COUNT=$(git diff origin/${PR_BASE} -- CHANGELOG.md | wc -l) | |
| README_RADAR_COUNT=$(git diff origin/${PR_BASE} -- README_RADAR.md | wc -l) | |
| TOTAL_COUNT=$((CHANGELOG_COUNT + README_RADAR_COUNT)) | |
| if [ ${TOTAL_COUNT} -eq 0 ]; then | |
| printf "\x1b[31;1mNo CHANGELOG entries detected in CHANGELOG.md or README_RADAR.md. Consider whether this PR warrants one, for example:\x1b[0m\n" | |
| printf "\x1b[33;1m* ${PR_TITLE} [#${PR_NUMBER}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/${PR_NUMBER})\x1b[0m\n" | |
| exit 1 | |
| fi | |
| # TODO: validate changelog line format | |
| spell-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Spell-check | |
| uses: crate-ci/typos@v1.15.7 | |
| with: | |
| config: ./.github/workflows/typos.toml |