Skip to content

Commit

Permalink
chore: Update GitHub Action configuration for dotnet-format on Pull R…
Browse files Browse the repository at this point in the history
…equest
  • Loading branch information
tsubakimoto committed Aug 12, 2024
1 parent 021a395 commit 5e3ee1b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ dotnet-format for GitHub Actions

See [action.yml](action.yml)

**Basic**:
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- uses: tsubakimoto/action-dotnet-format@v0
with:
base-branch: ${{ github.head_ref }}
project-path: 'example.csproj'
github-token: ${{ secrets.GITHUB_TOKEN }}
```
### Permissions
The `GITHUB_TOKEN` secret is required to create a pull request.

| Permission | Value |
| --- | --- |
| `contents` | `write` |
| `pull_requests` | `write` |

## License

The scripts and documentation in this project are released under the [MIT License](LICENSE)
7 changes: 5 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ inputs:
description: 'Verbosity of the output'
required: false
default: 'normal'
github-token:
description: 'GitHub token'
required: true
outputs:
head-branch:
description: 'Head branch to compare against'
Expand Down Expand Up @@ -53,7 +56,7 @@ runs:
echo "head-branch-name: $HEAD_BRANCH"
echo "head-branch-name=$HEAD_BRANCH" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ inputs.github-token }}
shell: bash
- name: Create a pull request
id: pr
Expand All @@ -69,5 +72,5 @@ runs:
echo "Successfully created pull request: $url"
echo "url=$url" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ inputs.github-token }}
shell: bash

0 comments on commit 5e3ee1b

Please sign in to comment.