Skip to content

Commit e0a0717

Browse files
committed
fix: skip action when the sender is dependabot
1 parent 14e354d commit e0a0717

File tree

9 files changed

+26
-13
lines changed

9 files changed

+26
-13
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"parserOptions": {
66
"ecmaVersion": 9,
77
"sourceType": "module",
8-
"project": "./tsconfig.json"
8+
"project": "./tsconfig.eslint.json"
99
},
1010
"rules": {
1111
"no-console": "off",

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
add:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: benelan/[email protected].0
25+
- uses: benelan/[email protected].1
2626
with:
2727
farthest: true # remove this line to add the current milestone
2828
```

dist/index.js

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "milestone-action",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"private": true,
55
"description": "A GitHub Action that automatically sets the current or farthest due milestone on issues and pull requests.",
66
"main": "lib/main.js",

src/main.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ async function run(): Promise<void> {
55
try {
66
const {
77
repo,
8-
payload: {action, issue, pull_request},
8+
payload: {action, sender, issue, pull_request},
99
issue: {number: issue_number}
1010
} = context
1111

12+
// https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
13+
if (sender && sender.login === 'dependabot[bot]') {
14+
console.log('Dependabot created the pull request, ending run.')
15+
}
16+
1217
if (action !== 'opened') {
13-
console.log('No issue or pull request was opened, ending run')
18+
console.log('No issue or pull request was opened, ending run.')
1419
return
1520
}
1621

@@ -40,7 +45,7 @@ async function run(): Promise<void> {
4045
})
4146

4247
if (milestones.length === 0) {
43-
console.log('There are no open milestones in this repo, skipping.')
48+
console.log('There are no open milestones in this repo, ending run.')
4449
return
4550
}
4651

tsconfig.eslint.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"exclude": ["node_modules"]
4+
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
1010
},
1111
"exclude": ["node_modules", "**/*.test.ts"]
12-
}
12+
}

0 commit comments

Comments
 (0)