|
6 | 6 | [](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml) |
7 | 7 | [](./badges/coverage.svg) |
8 | 8 |
|
9 | | -> [!NOTE] The current version of this action only supports pinning the exact |
10 | | -> Dart SDK version (e.g., `sdk: 3.1.0`). It does not yet support version ranges |
11 | | -> (e.g., `sdk: '>=3.1.0 <4.0.0'`). |
12 | | -
|
13 | | -**flutter-dart-sync** is a GitHub Action that automatically updates the Dart SDK |
14 | | -version in your `pubspec.yaml` to match the Dart version bundled with the |
15 | | -installed Flutter SDK. This ensures that your project's Dart SDK constraint is |
16 | | -always in sync with the Flutter version used in your CI environment. |
| 9 | +> [!NOTE] This action currently pins the Dart SDK to the exact version bundled |
| 10 | +> with the installed Flutter SDK (for example: `environment: sdk: "3.1.0"`). It |
| 11 | +> does not generate or maintain version ranges (for example: |
| 12 | +> `">=3.1.0 <4.0.0"`). You can auto commit the changes using the GitHub App |
| 13 | +> integration if desired. |
17 | 14 |
|
18 | 15 | ## Inputs |
19 | 16 |
|
20 | | -| Name | Description | Required | Default | |
21 | | -| ------------------------------- | --------------------------------------------------------------- | -------- | ---------------- | |
22 | | -| `pubspec_path` | Path to the `pubspec.yaml` file. | `true` | `./pubspec.yaml` | |
23 | | -| `fail_if_flutter_not_installed` | Whether to fail the action if the Flutter SDK is not installed. | `false` | `false` | |
| 17 | +| Name | Description | Required | Default | |
| 18 | +| ------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------- | ---------------- | |
| 19 | +| `pubspec_path` | Path to the `pubspec.yaml` file. | `true` | `./pubspec.yaml` | |
| 20 | +| `fail_if_flutter_not_installed` | Whether to fail the action if the Flutter SDK is not installed. | `false` | `false` | |
| 21 | +| `commit_changes` | If `true`, attempt to commit the updated `pubspec.yaml` using GitHub App. | `false` | `false` | |
| 22 | +| `commit_message` | Commit message to use when committing changes (required if `commit_changes` is `true`). | `📌 Sync Dart SDK version with Flutter` | `` | |
| 23 | +| `gh_app_id` | GitHub App ID (required for committing via the GitHub App flow). | `false` | `` | |
| 24 | +| `gh_installation_id` | GitHub App installation ID (required for committing via the GitHub App). | `false` | `` | |
| 25 | +| `gh_private_key` | GitHub App private key (PEM) used to authenticate the App. | `false` | `` | |
24 | 26 |
|
25 | 27 | ## Usage |
26 | 28 |
|
@@ -48,17 +50,26 @@ jobs: |
48 | 50 | flutter-version: '3.16.0' # Example version |
49 | 51 |
|
50 | 52 | - name: Sync Dart SDK version with Flutter |
51 | | - uses: IamPekka058/flutter-dart-sync@v1 # Replace with the correct version |
| 53 | + uses: IamPekka058/flutter-dart-sync@v1 |
52 | 54 | with: |
53 | 55 | pubspec_path: './pubspec.yaml' |
54 | 56 | fail_if_flutter_not_installed: true |
55 | 57 |
|
56 | 58 | # Add subsequent steps like flutter pub get, build, test, etc. |
57 | 59 | - name: Install Dependencies |
58 | 60 | run: flutter pub get |
| 61 | +``` |
59 | 62 |
|
60 | | - - name: Run Tests |
61 | | - run: flutter test |
| 63 | +```yaml |
| 64 | +- name: Sync Dart and commit via GitHub App |
| 65 | + uses: IamPekka058/flutter-dart-sync@v1 |
| 66 | + with: |
| 67 | + pubspec_path: './pubspec.yaml' |
| 68 | + commit_changes: true |
| 69 | + commit_message: 'chore: sync Dart SDK with Flutter' |
| 70 | + gh_app_id: ${{ secrets.GH_APP_ID }} |
| 71 | + gh_installation_id: ${{ secrets.GH_INSTALLATION_ID }} |
| 72 | + gh_private_key: ${{ secrets.GH_PRIVATE_KEY }} |
62 | 73 | ``` |
63 | 74 |
|
64 | 75 | ## License |
|
0 commit comments