Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MP-907] Detect Secrets Action共有 #1

Merged
merged 4 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}