Skip to content

Commit

Permalink
fixup! Create new action for converting conventional PR titles into T…
Browse files Browse the repository at this point in the history
…optal commit
  • Loading branch information
Augusto Moura committed Nov 14, 2023
1 parent eecb042 commit 61b8427
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
12 changes: 10 additions & 2 deletions pr-conventional-to-toptal-commits/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ Convert a PR title from conventional commits to Toptal commit

### Inputs

Not specified
The list of arguments, that are used in GH Action:

| name | type | required | default | description |
| -------------- | ------ | -------- | ------- | ----------------- |
| `github-token` | string || | Github user token |

### Outputs

Expand All @@ -21,15 +25,19 @@ Not specified
Formatting dependabot commit messages:

```yaml
name: Format dependabot PR title to Toptal's commit convention
on:
pull_request:
types: [opened]
branches: [master]

jobs:
format_title:
name: Format title
if: startsWith(github.head_ref, 'dependabot-')
runs-on: ['org/toptal', 'os/linux', 'arch/x64', 'size/large']
runs-on: ['org/toptal', 'os/linux', 'arch/x64', 'size/large', 'ubuntu-latest']
steps:
- uses: toptal/davinci-github-actions/pr-conventional-to-toptal-commits
with:
github-token: ${{ secrets.TOPTAL_DEVBOT_TOKEN }}
```
15 changes: 10 additions & 5 deletions pr-conventional-to-toptal-commits/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: PR Conventional to Toptal Commit
description: Convert a PR title from conventional commits to Toptal commit

inputs:
github-token:
required: true
description: Github user token

runs:
using: composite
steps:
Expand All @@ -20,12 +25,12 @@ runs:
}
const newPr = {
owner: github.context.repo.owner,
repo: github.context.repo.repo,
pull_number: github.context.payload.pull_request.number,
title: convertConventional(github.context.payload.pull_request.title)
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
title: convertConventional(context.payload.pull_request.title)
}
octokit.pulls.update(newPr);
github.pulls.update(newPr);

0 comments on commit 61b8427

Please sign in to comment.