Skip to content

Commit

Permalink
Merge pull request #3 from gitignore-in/improve
Browse files Browse the repository at this point in the history
Improve and make it works
  • Loading branch information
kitsuyui authored Oct 7, 2023
2 parents cd070ed + c886fb7 commit c4b2e0b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
- pull_request

permissions:
contents: read
contents: write
pull-requests: write
issues: write

Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# GitHub Action for gitignore-in

WIP
gitignore-in is a tool to generate .gitignore files from templates.
This action runs gitignore-in and commits the result to the repository.

## Example

.gitignore.in is a template file for gitignore-in. And this works as ordinary shell script.

```bash
gibo dump macOS
gibo dump Windows
echo "node_modules/"
```

```
$ gitignore-in
Generated .gitignore
```

If the .gitignore.in is changed, the action will create pull request automatically.

## Usage

Expand Down
21 changes: 18 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ author: Yui KITSU
description: |
Run gitignore-in command and if .gitignore is updated, generate pull request.
branding:
icon: folder-minus
icon: file-minus
color: white

inputs:
Expand All @@ -19,15 +19,29 @@ inputs:
Default: main
required: false
default: main
outputs: {}
outputs:
pull-request-number:
description: Pull request number.
value: ${{ steps.create_pull_request.outputs.pull-request-number }}
pull-request-url:
description: Pull request URL.
value: ${{ steps.create_pull_request.outputs.pull-request-url }}
pull-request-operation:
description: |
The pull request operation performed by the action, `created`, `updated` or `closed`.
value: ${{ steps.create_pull_request.outputs.pull-request-operation }}
pull-request-head-sha:
description: |
The SHA of the head commit of the pull request.
value: ${{ steps.create_pull_request.outputs.pull-request-head-sha }}

runs:
using: composite
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
branch: ${{ inputs.base_branch }}
ref: ${{ inputs.base_branch }}

- uses: gitignore-in/[email protected]
- run: |
Expand All @@ -54,6 +68,7 @@ runs:
shell: bash

- uses: peter-evans/create-pull-request@v5
id: create_pull_request
with:
branch: ${{ inputs.branch_name }}
base: ${{ inputs.base_branch }}
Expand Down

0 comments on commit c4b2e0b

Please sign in to comment.