From d0ab07d5955dcf4de816ed27e565debe3f4576e4 Mon Sep 17 00:00:00 2001 From: Adam Bovill Date: Fri, 7 Jun 2024 06:37:40 +0000 Subject: [PATCH] feat(pull-request): add some expectations for PR as well as lint support Adds expectations for PR creation as well as a reusable workflow that can be used to lint PRs. --- .github/workflows/ci.pr-lint.yaml | 12 ++++++ .github/workflows/release.yaml | 11 ++++++ .../workflows/reusable-workflow.pr-lint.yaml | 17 +++++++++ docs/pull-requests.md | 37 +++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 .github/workflows/ci.pr-lint.yaml create mode 100644 .github/workflows/reusable-workflow.pr-lint.yaml create mode 100644 docs/pull-requests.md diff --git a/.github/workflows/ci.pr-lint.yaml b/.github/workflows/ci.pr-lint.yaml new file mode 100644 index 0000000..59f1cf7 --- /dev/null +++ b/.github/workflows/ci.pr-lint.yaml @@ -0,0 +1,12 @@ +name: CI + +on: + pull_request: + types: [edited, opened, reopened, synchronize] + branches: [main] + +jobs: + pr-lint: + name: PR Lint + uses: ./.github/workflows/reusable-workflow.pr-lint.yaml + secrets: inherit diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9074898..c4505fc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -59,6 +59,17 @@ jobs: run: mkdocs build --config-file ./mkdocs.yml --site-dir ./_site - name: Upload artifact uses: actions/upload-pages-artifact@v3 + - name: Fetch tags + if: steps.release.outputs.new-release-published == 'true' + shell: bash + run: | + git fetch --tags + git clean -fd + - name: Major branch + if: steps.release.outputs.new-release-published == 'true' + uses: open-turo/action-major-release@v1 + with: + major-version: ${{ steps.release.outputs.new-release-major-version }} # Deployment job deploy: diff --git a/.github/workflows/reusable-workflow.pr-lint.yaml b/.github/workflows/reusable-workflow.pr-lint.yaml new file mode 100644 index 0000000..bb75e93 --- /dev/null +++ b/.github/workflows/reusable-workflow.pr-lint.yaml @@ -0,0 +1,17 @@ +name: "Workflow: PR Lint" + +on: + workflow_call: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + publish: + name: Lint PR + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Validate Checklists + uses: roryq/checkmate@master diff --git a/docs/pull-requests.md b/docs/pull-requests.md new file mode 100644 index 0000000..f9495c2 --- /dev/null +++ b/docs/pull-requests.md @@ -0,0 +1,37 @@ +# Pull Request standards + +Our baseline standards follow +teh [GitHub: Best practices for pull requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/getting-started/best-practices-for-pull-requests) + +## Additional standards and expectations + +### Standard names for checks + +When creating status checks, we expect the following names to be used: + +- Lint +- Test +- PR Lint + +#### Lint + +Perform linting checks on the codebase. This should include checks for formatting, style, and other linting checks. It +is suggested to use a tool such as pre-commit to perform these checks. + +#### Test + +When you have the ability to run tests, we expect them to run on all PRs and report as `Test`. + +#### PR Lint + +Not only should you look into writing good code and commits, but your pull requests should also be written with +intention. Where possible, we should add appropriate linting. These should repot as `PR Lint`. + +##### Checkboxes + +Adding checkboxes to PRs is a really powerful way to help reviewers understand what you have done and what you expect to +be done. We suggest the following checkboxes be added to PRs: + +- Use [Checkmate checkboxes](https://github.com/RoryQ/checkmate) +- Use the reusable workflow in this repo to lint your PRs +- Have a requited check for `PR Lint`