Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 Jul 31, 2023
72e9520
seperate job to run fomrat and fix
denrase Aug 14, 2023
76cee35
Merge branch 'main' into chore/format-and-analyze-check-only
denrase Aug 14, 2023
93ae771
rename file
denrase Aug 14, 2023
046e029
run workflow file once
denrase Aug 14, 2023
3782d61
update how workflow is run
denrase Aug 14, 2023
7bfeb23
run fix/apply in all packages
denrase Aug 14, 2023
d1e4030
fix workflow
denrase Aug 14, 2023
4859923
run in root dir
denrase Aug 14, 2023
9558cfb
update path
denrase Aug 14, 2023
cb0a512
extract branch name
denrase Aug 14, 2023
7aef82c
Format & fix code
getsentry-bot Aug 14, 2023
fc0be25
revert changes
denrase Aug 14, 2023
1c6f8aa
setup flutter
denrase Aug 14, 2023
9b8d4f4
don’t commit
denrase Aug 14, 2023
777880f
run pin package directories
denrase Aug 14, 2023
85f656b
add strategy
denrase Aug 14, 2023
5ca84a6
only run on workflow dispatch
denrase Aug 14, 2023
149a2e9
Merge branch 'main' into chore/format-and-analyze-check-only
denrase Aug 22, 2023
8ac5c4d
Merge branch 'main' into chore/format-and-analyze-check-only
denrase Aug 29, 2023
43b2ba7
run `dart fix --apply`
denrase Aug 29, 2023
09cc913
Merge branch 'main' into chore/format-and-analyze-check-only
denrase Sep 4, 2023
1872854
run fix & format
denrase Sep 4, 2023
2b40bb6
Merge branch 'main' into chore/format-and-analyze-check-only
denrase Sep 4, 2023
3686698
Use ios sim 16.4
denrase Sep 5, 2023
7e5ba02
Merge branch 'main' into chore/format-and-analyze-check-only
denrase Sep 5, 2023
2b3c979
Merge branch 'main' into chore/format-and-analyze-check-only
denrase Sep 11, 2023
1087024
format & fix
denrase Sep 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
seperate job to run fomrat and fix
  • Loading branch information
denrase committed Aug 14, 2023
commit 72e95204440695e68249cbc2a37e957cd6331fd1
46 changes: 46 additions & 0 deletions .github/workflows/format_and_fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
workflow_call:
inputs:
package:
required: true
type: string
sdk:
required: false
type: string
default: dart

jobs:
cancel-previous-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # [email protected]
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
defaults:
run:
working-directory: ${{ inputs.package }}
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1
if: ${{ inputs.sdk == 'dart' }}
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # [email protected]
if: ${{ inputs.sdk == 'flutter' }}

- run: ${{ inputs.sdk }} pub get

- run: dart format .

- run: dart fix --apply

# 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.
- run: ../scripts/commit-formatted-code.sh $GITHUB_HEAD_REF
if: env.GITHUB_HEAD_REF != null
16 changes: 16 additions & 0 deletions scripts/commit-formatted-code.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -euo pipefail

GITHUB_BRANCH="${1}"

if [[ $(git status) == *"nothing to commit"* ]]; then
echo "Nothing to commit. All code formatted correctly."
else
echo "Formatted some code. Going to push the changes."
git config --global user.name 'Sentry Github Bot'
git config --global user.email '[email protected]'
git fetch
git checkout ${GITHUB_BRANCH}
git commit -am "Format & fix code"
git push --set-upstream origin ${GITHUB_BRANCH}
fi