Skip to content

Commit

Permalink
Revise sample workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
xt0rted committed Mar 4, 2020
1 parent dbfb5aa commit 0970ccd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
uses: xt0rted/dotnet-format@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
fail-fast: "true"
```
Running on `pull_request`.
Expand Down Expand Up @@ -63,7 +62,7 @@ Running on demand by pull request comment, triggered by the text `/dotnet format
> To push fixes back to the pull request branch you'll need to [setup a secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) with a [Personal Access Token](https://github.com/settings/tokens/new?scopes=repo&description=github%20actions) that has the `repo` scope.

```yml
name: Format on Slash Command
name: Format on slash command
on:
issue_comment:
types: created
Expand All @@ -80,7 +79,7 @@ jobs:
command: dotnet
reaction-type: "eyes"
- name: Get PR branch info
- name: Get branch info
if: steps.command.outputs.command-name
id: comment-branch
uses: xt0rted/pull-request-comment-branch@v1
Expand All @@ -100,13 +99,15 @@ jobs:
- name: Run dotnet format
if: steps.command.outputs.command-name && steps.command.outputs.command-arguments == 'format'
id: format
uses: xt0rted/dotnet-format@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
only-changed-files: "true"
action: "fix"
only-changed-files: true
- name: Commit files
if: steps.command.outputs.command-name && steps.command.outputs.command-arguments == 'format'
if: steps.command.outputs.command-name && steps.command.outputs.command-arguments == 'format' && steps.format.outputs.has-changes == 'true'
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand All @@ -115,7 +116,7 @@ jobs:
Co-authored-by: ${{ github.event.comment.user.login }} <${{ github.event.comment.user.id }}+${{ github.event.comment.user.login }}@users.noreply.github.com>'
- name: Push changes
if: steps.command.outputs.command-name && steps.command.outputs.command-arguments == 'format'
if: steps.command.outputs.command-name && steps.command.outputs.command-arguments == 'format' && steps.format.outputs.has-changes == 'true'
uses: ad-m/[email protected]
with:
branch: ${{ steps.comment-branch.outputs.ref }}
Expand Down

0 comments on commit 0970ccd

Please sign in to comment.