Skip to content

Commit

Permalink
[MP-907] Detect Secrets Action共有 (#1)
Browse files Browse the repository at this point in the history
* add action

* add lint

* Update README.md

* Update README.md
  • Loading branch information
Han Sen authored Jan 10, 2024
1 parent e481535 commit 5e6088f
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Workflows Linter

on:
push:

jobs:
workflows-linter:
uses: sensyn-robotics/github-actions/.github/workflows/actionlint.yaml@main
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
# github-action-detect-secrets
# github-action-detect-secrets

## About
This is github action for running [detect-secrets](https://github.com/Yelp/detect-secrets) hook.

it will run againts all files managed in git repository


## Prerequisites
create a baseline file for your repository

please refer: https://github.com/Yelp/detect-secrets?tab=readme-ov-file#adding-secrets-to-baseline

## Usage

<!-- start usage -->
```yaml
- uses: sensyn-robotics/github-action-detect-secrets@v1
with:
# Baseline file for detect-secrets, relative to the mount-path
# Default; .secrets.baseline
baseline: '.secrets.baseline'

# Version of detect-secrets
# When not specified, use latest
detect-secrets-version: "1.4.0"
```
<!-- end usage -->
**Basic:**
```yaml
steps:
- uses: actions/checkout@v3
- name: Run DetectSecrets
uses: sensyn-robotics/github-action-detect-secrets@v1
```
28 changes: 28 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'detect-secrets-action'
description: 'Run detect-secrets on your codebase'
inputs:
baseline:
description: 'Baseline file path (relative to mount-path)'
required: true
default: '.secrets.baseline'
detect-secrets-version:
description: 'detect-secrets version'

runs:
using: "composite"
steps:
- name: install detect-secrets
shell: bash
env:
VERSION: ${{ inputs.detect-secrets-version }}
run: |
if [ -z "$VERSION" ]; then
pip install detect-secrets
else
pip install detect-secrets==$VERSION
fi
- name: run detect-secrets
run: git ls-files -z | xargs -0 detect-secrets-hook --verbose --baseline $BASELINE
shell: bash
env:
BASELINE: ${{ inputs.baseline }}

0 comments on commit 5e6088f

Please sign in to comment.