Skip to content

Commit

Permalink
feat(action): add initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
akantcheff committed Feb 15, 2024
1 parent 02514c1 commit f59ad6c
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
actions-minor:
update-types:
- minor
- patch
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Continuous Integration

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
test-action:
name: GitHub Actions Test
runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Create dummy file
run: |
echo 'Hello World' > test-file.txt
- name: Test Local Action
id: test-action
uses: ./
with:
keeper-secret-config: ${{ secrets.KSM_CONFIG }}

- name: Commit
run: |
git add .
git commit -m "Test verified commit"
git show --show-signature
git verify-commit HEAD
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# git-setup-action
Configure Git user with signing key for Github Actions

## Input

| Name | Description |
| ------------------------ |---------------------------------------------------------|
| `keeper-secret-config` | The Keeper Secret Manager configuration |

## Usage

```yaml
jobs:
setup-git:
runs-on: ubuntu-latest
steps:
- name: Setup Git Settings
uses: bonitasoft/git-setup-action@TAGNAME
with:
keeper-secret-config: ${{ secrets.KSM_CONFIG }}
```
36 changes: 36 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Setup Git Settings
description: Composite GitHub Action to configure Git to sign commits with CI technical user
inputs:
keeper-secret-config:
description: The Keeper Secret Manager configuration
required: true

runs:
using: composite
steps:
- name: Retrieve Artifactory secrets from Keeper
uses: Keeper-Security/ksm-action@master
with:
keeper-secret-config: ${{ inputs.keeper-secret-config }}
secrets: |
kE5H6L68vUluOHvClGRl9A/custom_field/gpg-private-key > env.GPG_PRIVATE_KEY
kE5H6L68vUluOHvClGRl9A/custom_field/gpg-passphrase > env.GPG_PASSPHRASE
# commit author's name and email are set automatically with those associated to GPG key
- name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ env.GPG_PRIVATE_KEY }}
passphrase: ${{ env.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true

- name: GPG user IDs
shell: bash
run: |
echo "fingerprint: ${{ steps.import-gpg.outputs.fingerprint }}"
echo "keyid: ${{ steps.import-gpg.outputs.keyid }}"
echo "name: ${{ steps.import-gpg.outputs.name }}"
echo "email: ${{ steps.import-gpg.outputs.email }}"

0 comments on commit f59ad6c

Please sign in to comment.