Skip to content

Commit 5611fcf

Browse files
committed
Secure test workflow
1 parent 7a93784 commit 5611fcf

1 file changed

Lines changed: 15 additions & 22 deletions

File tree

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
name: CI
1+
name: Test
22

33
on:
44
push:
55
branches:
6-
- "*"
7-
pull_request_target:
6+
- "**"
7+
pull_request:
88
types:
9-
- assigned
9+
- opened
10+
- reopened
1011
- synchronize
1112

13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: ci-${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name
19+
== 'pull_request_target' }}
20+
1221
jobs:
1322
test:
1423
runs-on: ubuntu-24.04
@@ -23,18 +32,10 @@ jobs:
2332
BUNDLE_WITHOUT: lint
2433
steps:
2534
- name: Checkout code
26-
if: github.event_name == 'push'
27-
uses: actions/checkout@v5
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2836
with:
2937
persist-credentials: false
3038

31-
- name: Checkout PR code
32-
if: github.event_name == 'pull_request_target'
33-
uses: actions/checkout@v4
34-
with:
35-
ref: ${{ github.event.pull_request.head.ref }}
36-
repository: ${{ github.event.pull_request.head.repo.full_name }}
37-
3839
- name: Set up Ruby
3940
uses: ruby/setup-ruby@v1
4041
with:
@@ -51,18 +52,10 @@ jobs:
5152
runs-on: ubuntu-24.04
5253
steps:
5354
- name: Checkout code
54-
if: github.event_name == 'push'
55-
uses: actions/checkout@v5
55+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5656
with:
5757
persist-credentials: false
5858

59-
- name: Checkout PR code
60-
if: github.event_name == 'pull_request_target'
61-
uses: actions/checkout@v4
62-
with:
63-
ref: ${{ github.event.pull_request.head.ref }}
64-
repository: ${{ github.event.pull_request.head.repo.full_name }}
65-
6659
- name: Set up Ruby
6760
uses: ruby/setup-ruby@v1
6861
with:

0 commit comments

Comments
 (0)