Skip to content

Commit f8d67e2

Browse files
committed
chore: avoid duplicate actions runs
As explained here: - https://wildwolf.name/github-actions-how-to-avoid-running-the-same-workflow-multiple-times/ Before: - If I pushed to a branch, without making a PR, actions would run once. - If I pushed to a branch, then opened a PR, actions would run twice. - If somebody else opened a PR (from a fork), actions would run once. After: - If I push to a branch, without making a PR, actions will run once. - If I push to a branch, then open a PR, actions will run once (ie. due to the push, not the PR). - If somebody else opens a PR (from a fork), actions will run once.
1 parent f6a6cf7 commit f8d67e2

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

.github/workflows/lua.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
name: lua
2-
on: [push, pull_request]
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
311
jobs:
412
style:
513
runs-on: ubuntu-latest
14+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
615
steps:
716
- uses: actions/checkout@v2
817
- uses: JohnnyMorganz/stylua-action@1.0.0
@@ -17,6 +26,7 @@ jobs:
1726

1827
test:
1928
runs-on: ubuntu-latest
29+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
2030
steps:
2131
- uses: actions/checkout@v2
2232
- uses: leafo/gh-actions-lua@v9

.github/workflows/prettier.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
name: prettier
2-
on: [push, pull_request]
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
311
jobs:
412
style:
513
runs-on: ubuntu-latest
14+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
615
steps:
716
- uses: actions/checkout@v2
817
- uses: actionsx/prettier@v2

.github/workflows/ruby.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
name: ruby
2-
on: [push, pull_request]
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
311
jobs:
412
style:
513
runs-on: ubuntu-latest
14+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
615
steps:
716
- uses: actions/checkout@v2
817
- uses: jidicula/clang-format-action@v4.8.0
@@ -12,6 +21,7 @@ jobs:
1221

1322
test:
1423
runs-on: ubuntu-latest
24+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
1525
steps:
1626
- uses: actions/checkout@v2
1727
- name: Install libraries

0 commit comments

Comments
 (0)