Skip to content

Commit 8e01722

Browse files
committed
chore: manually resolved conflicting changes from origin
1 parent 9ee4508 commit 8e01722

6 files changed

Lines changed: 55 additions & 36 deletions

File tree

.eslintrc.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ See [Conventional Commits](https://www.conventionalcommits.org/) for more exampl
1919

2020
1. If your goal is to create squashed commits that will be used for automated releases, you'll want to configure your GitHub repository to [use the squash & merge strategy](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests) and tick the option "Default to PR title for squash merge commits".
2121
2. [Add the action](https://docs.github.com/en/actions/quickstart) with the following configuration:
22+
2223
```yml
23-
name: "Lint PR"
24+
name: 'Lint PR'
2425

2526
on:
2627
pull_request_target:
@@ -36,7 +37,7 @@ jobs:
3637
permissions:
3738
pull-requests: read
3839
steps:
39-
- uses: step-security/action-semantic-pull-request@v5
40+
- uses: step-security/action-semantic-pull-request@v6
4041
env:
4142
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4243
```
@@ -123,7 +124,7 @@ This will prevent the PR title from being validated, and pull request checks wil
123124
**Attention**: If you want to use the this feature, you need to grant the `pull-requests: write` permission to the GitHub Action. This is because the action will update the status of the PR to remain in a pending state while `[WIP]` is present in the PR title.
124125

125126
```yml
126-
name: "Lint PR"
127+
name: 'Lint PR'
127128
128129
permissions:
129130
pull-requests: write
@@ -135,7 +136,7 @@ jobs:
135136
permissions:
136137
pull-requests: read
137138
steps:
138-
- uses: step-security/action-semantic-pull-request@v5
139+
- uses: step-security/action-semantic-pull-request@v6
139140
env:
140141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141142
with:
@@ -144,7 +145,7 @@ jobs:
144145

145146
### Legacy configuration for validating single commits
146147

147-
When using "Squash and merge" on a PR with only one commit, GitHub will suggest using that commit message instead of the PR title for the merge commit. As it's easy to commit this by mistake this action supports two configuration options to provide additional validation for this case.
148+
When using "Squash and merge" on a PR with only one commit, GitHub will suggest using that commit message instead of the PR title for the merge commit. As it's easy to commit this by mistake this action supports two configuration options to provide additional validation for this case.
148149

149150
```yml
150151
# If the PR only contains a single commit, the action will validate that
@@ -174,8 +175,8 @@ There are two events that can be used as triggers for this action, each with dif
174175
<details>
175176
<summary>Example</summary>
176177

177-
```yml
178-
name: "Lint PR"
178+
````yml
179+
name: 'Lint PR'
179180

180181
on:
181182
pull_request_target:
@@ -193,7 +194,7 @@ jobs:
193194
permissions:
194195
pull-requests: read
195196
steps:
196-
- uses: step-security/action-semantic-pull-request@v5
197+
- uses: step-security/action-semantic-pull-request@v6
197198
id: lint_pr_title
198199
env:
199200
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -206,21 +207,21 @@ jobs:
206207
header: pr-title-lint-error
207208
message: |
208209
Hey there and thank you for opening this pull request! 👋🏼
209-
210+
210211
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
211212
212213
Details:
213-
214+
214215
```
215216
${{ steps.lint_pr_title.outputs.error_message }}
216217
```
217218
218219
# Delete a previous comment when the issue has been resolved
219220
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
220221
uses: marocchino/sticky-pull-request-comment@v2
221-
with:
222+
with:
222223
header: pr-title-lint-error
223224
delete: true
224-
```
225+
````
225226

226227
</details>

eslint.config.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {getPresets} from 'eslint-config-molindo';
2+
import globals from 'globals';
3+
4+
export default [
5+
...(await getPresets('javascript', 'vitest')),
6+
{
7+
languageOptions: {
8+
globals: globals.node
9+
}
10+
}
11+
];

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"description": "Ensure your PR title matches the Conventional Commits spec.",
55
"main": "dist/index.js",
66
"scripts": {
7-
"lint": "eslint src",
8-
"test": "jest src",
9-
"build": "rm -rf dist && ncc build"
7+
"lint": "eslint src && prettier --check src",
8+
"test": "vitest src",
9+
"build": "rm -rf dist && rollup -c"
1010
},
1111
"repository": {
1212
"type": "git",
@@ -37,5 +37,6 @@
3737
},
3838
"engines": {
3939
"node": "^20.0.0"
40-
}
40+
},
41+
"prettier": "eslint-config-molindo/.prettierrc.json"
4142
}

rollup.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// See: https://rollupjs.org/introduction/
2+
3+
import commonjs from '@rollup/plugin-commonjs';
4+
import json from '@rollup/plugin-json';
5+
import {nodeResolve} from '@rollup/plugin-node-resolve';
6+
7+
const config = {
8+
input: 'src/index.js',
9+
output: {
10+
esModule: true,
11+
file: 'dist/index.js',
12+
format: 'es',
13+
sourcemap: true
14+
},
15+
plugins: [commonjs(), nodeResolve({preferBuiltins: true}), json()]
16+
};
17+
18+
export default config;

src/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
const core = require('@actions/core');
2-
const github = require('@actions/github');
3-
const axios = require('axios');
4-
const parseConfig = require('./parseConfig');
5-
const validatePrTitle = require('./validatePrTitle');
1+
import core from '@actions/core';
2+
import github from '@actions/github';
3+
import parseConfig from './parseConfig.js';
4+
import validatePrTitle from './validatePrTitle.js';
65

7-
module.exports = async function run() {
6+
export default async function run() {
87
try {
98
await validateSubscription();
109
const {
@@ -118,6 +117,7 @@ module.exports = async function run() {
118117
headerPattern,
119118
headerPatternCorrespondence
120119
});
120+
// eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-unused-vars -- Legacy syntax for compatibility
121121
} catch (error) {
122122
throw new Error(
123123
`Pull request has only one commit and it's not semantic; this may lead to a non-semantic commit in the base branch (see https://github.com/community/community/discussions/16271 ). Amend the commit message to match the pull request title, or add another commit.`
@@ -158,8 +158,8 @@ module.exports = async function run() {
158158
description: isWip
159159
? 'This PR is marked with "[WIP]".'
160160
: validationError
161-
? 'PR title validation failed'
162-
: 'Ready for review & merge.',
161+
? 'PR title validation failed'
162+
: 'Ready for review & merge.',
163163
context: 'action-semantic-pull-request'
164164
});
165165
}

0 commit comments

Comments
 (0)