Skip to content

Commit

Permalink
update (#41)
Browse files Browse the repository at this point in the history
* fix return

* chore: build, dist updated
  • Loading branch information
maxisam committed Oct 5, 2023
1 parent 4368d11 commit 0ef66c1
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 42 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: '🌞 CI'
name: "🌞 CI"

on:
workflow_dispatch:
workflow_dispatch:
pull_request:
paths-ignore:
- '**.md'
- "**.md"
- dist/**
- __tests__/dotnet/**
push:
branches:
- main
paths-ignore:
- '**.md'
- "**.md"
- dist/**
- __tests__/dotnet/**
jobs:
Expand All @@ -27,7 +27,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
cache: "yarn"

- run: yarn install

Expand All @@ -46,10 +46,22 @@ jobs:
fi
- name: commit build
id: commit
if: ${{ env.diff == 'true' }}
run: |
git config --local user.email "maxisam@gmail.com"
git config --local user.name "maxisam"
git add dist/
git commit -m "chore: build, dist updated"
git push origin ${{ github.event.pull_request.head.ref || github.ref_name }}
sha=$(git rev-parse HEAD)
echo "sha=$sha" >> $GITHUB_OUTPUT
- name: Status update
if: ${{ env.diff == 'true' }}
uses: myrotvorets/set-commit-status-action@v2.0.0
with:
status: "success"
sha: ${{ steps.commit.outputs.sha }}
description: "Build Dist Updated"
context: "Build Dist Updated"
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ Yet another dotnet format. It combines dotnet format with jscpd to provide a sin
- JSCPD, can be configured with `.jscpd.json (yml)` file
- Generate reports as GitHub Action artifact
- Generate reports as comment on PR
- (optional) commit changes

## Usage

Currently this action is focused on running on PRs.
example:

- [example workflow](.github/workflows/test-dotnet-format.yml)
- [example dotnet-format config](./__tests__/dotnet/ConfigConsoleApp/.dotnet-format.json)
- [example jscpd config](./__tests__/dotnet/ConfigConsoleApp/.jscpd.json)
- [Action input](./action.yml)
- [example workflow](.github/workflows/test-dotnet-format.yml)
- [example dotnet-format config](./__tests__/dotnet/ConfigConsoleApp/.dotnet-format.json)
- [example jscpd config](./__tests__/dotnet/ConfigConsoleApp/.jscpd.json)
- [Action input](./action.yml)

## Aknowledgements

Expand Down
64 changes: 34 additions & 30 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ async function postReportasComment(reportFiles: string[], githubClient: Instance
return await Common.RemoveReportFiles();
}

async function commitChanges(cwd: string, inputs: IInputs) {
async function commitChanges(cwd: string, inputs: IInputs): Promise<boolean> {
const isInit = await git.init(cwd, inputs.commitUsername, inputs.commitUserEmail);
const currentBranch = Common.getCurrentBranch();
const isCommit = isInit && (await git.commit(cwd, inputs.commitMessage, currentBranch));
isCommit && (await git.push(currentBranch));
return isCommit && (await git.push(currentBranch));
}

async function execFormat(formatArgs: string[][]): Promise<boolean> {
Expand Down

0 comments on commit 0ef66c1

Please sign in to comment.