Skip to content

Commit 0bae738

Browse files
File sync from hanakai-rb/repo-sync
Updated files: - .github/workflows/ci.yml - .github/workflows/pr-comments.yml - .github/workflows/repo-sync-preview.yml - .github/workflows/rubocop.yml - .github/workflows/ci-lint.yml - zizmor.yml
1 parent 8c03ab9 commit 0bae738

File tree

6 files changed

+59
-14
lines changed

6 files changed

+59
-14
lines changed

.github/workflows/ci-lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI lint
2+
3+
on:
4+
push:
5+
branches: ["main", "release-*", "ci/*"]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: ["main", "release-*"]
9+
10+
permissions: {}
11+
12+
jobs:
13+
zizmor:
14+
name: Run zizmor
15+
runs-on: ubuntu-latest
16+
permissions:
17+
security-events: write # Required for upload-sarif (used by zizmor-action) to upload SARIF files.
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
21+
with:
22+
persist-credentials: false
23+
24+
- name: Run zizmor
25+
uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ jobs:
3333
COVERAGE: ${{ matrix.coverage }}
3434
steps:
3535
- name: Checkout
36-
uses: actions/checkout@v3
36+
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
3737
- name: Install package dependencies
3838
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
3939
- name: Set up Ruby
40-
uses: ruby/setup-ruby@v1
40+
uses: ruby/setup-ruby@896e71e063dc0933bb442a54e949d75291991ecb # zizmor: ignore[cache-poisoning]
4141
with:
4242
ruby-version: ${{ matrix.ruby }}
4343
bundler-cache: true
@@ -77,7 +77,7 @@ jobs:
7777
needs: tests
7878
steps:
7979
- name: Trigger release workflow
80-
uses: actions/github-script@v7
80+
uses: actions/github-script@450193c5abd4cdb17ba9f3ffcfe8f635c4bb6c2a
8181
with:
8282
github-token: ${{ secrets.RELEASE_MACHINE_DISPATCH_TOKEN }}
8383
script: |

.github/workflows/pr-comments.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
name: PR comments
1111

12-
on:
12+
on: # zizmor: ignore[dangerous-triggers]
1313
workflow_run:
1414
workflows: ["CI"]
1515
types:
@@ -21,6 +21,8 @@ permissions:
2121
jobs:
2222
post-comments:
2323
runs-on: ubuntu-latest
24+
permissions:
25+
pull-requests: write
2426
if: github.event.workflow_run.event == 'pull_request'
2527

2628
steps:
Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,42 @@
11
name: Repo-sync preview
22

3-
on:
3+
on: # zizmor: ignore[dangerous-triggers]
44
workflow_run:
5-
workflows: ["CI", "RuboCop"]
5+
workflows: ["CI", "RuboCop", "CI lint"]
66
types: [completed]
77
branches:
88
- "ci/repo-sync-preview-*"
99

1010
jobs:
1111
report:
1212
runs-on: ubuntu-latest
13+
permissions: {}
14+
if: >
15+
github.event.workflow_run.event == 'push' &&
16+
github.event.workflow_run.head_repository.fork == false
1317
steps:
1418
- name: Dispatch status to repo-sync
15-
uses: actions/github-script@v7
19+
uses: actions/github-script@450193c5abd4cdb17ba9f3ffcfe8f635c4bb6c2a
1620
with:
1721
github-token: ${{ secrets.REPO_SYNC_DISPATCH_TOKEN }}
1822
script: |
23+
const { BRANCH, REPO, WORKFLOW, STATUS, RUN_URL } = process.env;
1924
await github.rest.actions.createWorkflowDispatch({
2025
owner: "hanakai-rb",
2126
repo: "repo-sync",
2227
workflow_id: "aggregate-preview-status.yml",
2328
ref: "main",
2429
inputs: {
25-
pr_number: "${{ github.event.workflow_run.head_branch }}".replace("ci/repo-sync-preview-", ""),
26-
repo_name: "${{ github.repository }}",
27-
workflow_name: "${{ github.event.workflow_run.name }}",
28-
status: "${{ github.event.workflow_run.conclusion }}",
29-
run_url: "${{ github.event.workflow_run.html_url }}"
30+
pr_number: BRANCH.replace("ci/repo-sync-preview-", ""),
31+
repo_name: REPO,
32+
workflow_name: WORKFLOW,
33+
status: STATUS,
34+
run_url: RUN_URL
3035
}
3136
});
37+
env:
38+
BRANCH: ${{ github.event.workflow_run.head_branch }}
39+
REPO: ${{ github.repository }}
40+
WORKFLOW: ${{ github.event.workflow_run.name }}
41+
STATUS: ${{ github.event.workflow_run.conclusion }}
42+
RUN_URL: ${{ github.event.workflow_run.html_url }}

.github/workflows/rubocop.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ jobs:
2121
BUNDLE_ONLY: tools
2222

2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
25+
with:
26+
persist-credentials: false
2527

2628
- name: Set up Ruby 4.0
27-
uses: ruby/setup-ruby@v1
29+
uses: ruby/setup-ruby@896e71e063dc0933bb442a54e949d75291991ecb # zizmor: ignore[cache-poisoning]
2830
with:
2931
ruby-version: 4.0
3032
bundler-cache: true

zizmor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
rules:
2+
unpinned-uses:
3+
config:
4+
policies:
5+
hanakai-rb/*: ref-pin

0 commit comments

Comments
 (0)