Skip to content

Commit 6f0a898

Browse files
authored
update-gitleaksをdev-hato/actions-update-gitleaksに寄せる (#54)
1 parent 9de0548 commit 6f0a898

1 file changed

Lines changed: 2 additions & 43 deletions

File tree

.github/workflows/update-gitleaks.yml

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,49 +24,8 @@ jobs:
2424
cache: npm
2525
- name: Install packages
2626
run: npm ci --prefer-offline
27-
- name: Update .gitleaks.toml
28-
run: |
29-
version="$(grep super-linter .github/workflows/super-linter.yml | grep uses | sed -e 's/.*@//g')"
30-
curl "https://raw.githubusercontent.com/github/super-linter/${version}/TEMPLATES/.gitleaks.toml" > .gitleaks.toml
31-
- name: Update .pre-commit-config.yaml
32-
uses: actions/github-script@v6.1.0
27+
- uses: dev-hato/actions-update-gitleaks@v0.0.1
3328
with:
3429
github-token: ${{secrets.GITHUB_TOKEN}}
35-
script: |
36-
const fs = require('fs')
37-
const yaml = require('js-yaml')
38-
39-
const config_filename = '.pre-commit-config.yaml'
40-
const config = yaml.load(fs.readFileSync(config_filename, 'utf8'))
41-
const common_params = {
42-
owner: 'zricethezav',
43-
repo: 'gitleaks'
44-
}
45-
console.log("call repos.getLatestRelease:", common_params)
46-
const latest_release = await github.rest.repos.getLatestRelease(
47-
common_params
48-
)
49-
config.repos = config.repos.map(repo => {
50-
let repo_name = 'https://github.com/'
51-
repo_name += common_params.owner + '/' + common_params.repo
52-
53-
if (repo.repo === repo_name) {
54-
repo.rev = latest_release.data.tag_name
55-
}
56-
57-
return repo;
58-
})
59-
const content = '---\n' + yaml.dump(config)
60-
61-
try {
62-
fs.writeFileSync(config_filename, content, 'utf8')
63-
} catch (err) {
64-
console.error(err.message)
65-
process.exit(1)
66-
}
67-
- uses: ./
68-
with:
69-
github-token: ${{secrets.GITHUB_TOKEN}}
70-
branch-name-prefix: fix-version-pre-commit-config
71-
pr-title-prefix: gitleaksをアップデートしてあげたよ!
30+
super-linter-yml-file: .github/workflows/super-linter.yml
7231
repo-name: ${{ github.event.pull_request.head.repo.full_name }}

0 commit comments

Comments
 (0)