-
-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce workflow dispatch action forformat
& fix --apply
#1575
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
616aa76
Revert to check & fail only approach for format & analyze
denrase 72e9520
seperate job to run fomrat and fix
denrase 76cee35
Merge branch 'main' into chore/format-and-analyze-check-only
denrase 93ae771
rename file
denrase 046e029
run workflow file once
denrase 3782d61
update how workflow is run
denrase 7bfeb23
run fix/apply in all packages
denrase d1e4030
fix workflow
denrase 4859923
run in root dir
denrase 9558cfb
update path
denrase cb0a512
extract branch name
denrase 7aef82c
Format & fix code
getsentry-bot fc0be25
revert changes
denrase 1c6f8aa
setup flutter
denrase 9b8d4f4
don’t commit
denrase 777880f
run pin package directories
denrase 85f656b
add strategy
denrase 5ca84a6
only run on workflow dispatch
denrase 149a2e9
Merge branch 'main' into chore/format-and-analyze-check-only
denrase 8ac5c4d
Merge branch 'main' into chore/format-and-analyze-check-only
denrase 43b2ba7
run `dart fix --apply`
denrase 09cc913
Merge branch 'main' into chore/format-and-analyze-check-only
denrase 1872854
run fix & format
denrase 2b40bb6
Merge branch 'main' into chore/format-and-analyze-check-only
denrase 3686698
Use ios sim 16.4
denrase 7e5ba02
Merge branch 'main' into chore/format-and-analyze-check-only
denrase 2b3c979
Merge branch 'main' into chore/format-and-analyze-check-only
denrase 1087024
format & fix
denrase File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
cancel-previous-workflow: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # pin@0.11.0 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
format-and-fix: | ||
name: Format & fix code | ||
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
strategy: | ||
matrix: | ||
package: [ | ||
{name: dart, sdk: dart}, | ||
{name: dio, sdk: dart}, | ||
{name: file, sdk: dart}, | ||
{name: flutter, sdk: flutter}, | ||
{name: logging, sdk: dart}, | ||
{name: sqflite, sdk: flutter}, | ||
] | ||
defaults: | ||
run: | ||
working-directory: ${{ matrix.package.name }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1 | ||
if: ${{ matrix.package.sdk == 'dart' }} | ||
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0 | ||
if: ${{ matrix.package.sdk == 'flutter' }} | ||
|
||
- run: ${{ matrix.package.sdk }} pub get | ||
|
||
- run: dart format . | ||
|
||
- run: dart fix --apply | ||
|
||
# Source: https://stackoverflow.com/a/58035262 | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | ||
id: extract_branch | ||
|
||
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore | ||
# we need to pass the current branch, otherwise we can't commit the changes. | ||
# GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. | ||
- name: Commit & push | ||
run: ./scripts/commit-formatted-code.sh ${{ steps.extract_branch.outputs.branch }} | ||
Comment on lines
+50
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this can be replaced by @denrase https://github.com/stefanzweifel/git-auto-commit-action |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand why this is needed if the formatting workflow is now separated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail the workflow of there are formatting issues. If that happens, we can trigger the formatting workflow to resolve the issues.