|
24 | 24 | cache: npm |
25 | 25 | - name: Install packages |
26 | 26 | 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 |
33 | 28 | with: |
34 | 29 | 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 |
72 | 31 | repo-name: ${{ github.event.pull_request.head.repo.full_name }} |
0 commit comments