Skip to content

Commit f42d532

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Enforce repository formatting in GitHub CI (#2023)
Summary: Pull Request resolved: #2023 Add a dedicated GitHub Actions check for the repository-owned formatter contract and document the same commands for contributors. The job provisions the Java and Python runtimes needed by Yoga’s Kotlin and Python formatters before running `yarn format-check`. ___ Reviewed By: cipolleschi Differential Revision: D119662616 fbshipit-source-id: eeb03aa263d3e528ceb5b7f0884ce232153608ee
1 parent 1bdca55 commit f42d532

2 files changed

Lines changed: 42 additions & 2 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Validate Formatting
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- 'release-*'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
format:
16+
name: Format
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Setup JavaScript
22+
uses: ./.github/actions/setup-js
23+
24+
- name: Setup Java
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: temurin
28+
java-version: 17
29+
30+
- name: Setup Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: '3.12'
34+
35+
- name: Check formatting
36+
run: yarn format-check

‎CONTRIBUTING.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ We actively welcome your pull requests.
1414
1. Fork the repo and create your branch from `main`.
1515
2. If you've added code that should be tested, add tests
1616
3. If you've changed APIs, update the documentation.
17-
4. Ensure the test suite passes.
18-
5. Make sure your code lints.
17+
4. Format the repository with `yarn format`.
18+
5. Ensure the test suite passes and `yarn lint` succeeds.
1919
6. If you haven't already, complete the Contributor License Agreement ("CLA").
2020

21+
`yarn format-check` checks all maintained JavaScript and documentation, C-family,
22+
Kotlin, and Python sources without modifying them. Running all formatters requires
23+
Node and Yarn, Java 17 or newer, and Python 3 with pip.
24+
2125
## Contributor License Agreement ("CLA")
2226

2327
In order to accept your pull request, we need you to submit a CLA. You only need

0 commit comments

Comments
 (0)