Skip to content

Commit

Permalink
feat: initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
pcfreak30 committed Nov 16, 2024
1 parent 78ab19c commit eda6491
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024 Hammer Technologies LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# digger-action
Minimal Github Action for Digger.dev

Based off the official action

License is Apache-2.0 to match
77 changes: 77 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: run-digger
description: Run Digger for OpenTofu/Terraform management (optimized build)

inputs:
digger-spec:
description: "The spec to pass onto digger cli"
required: false
default: ''
aws-access-key-id:
description: AWS access key id
required: true
aws-secret-access-key:
description: AWS secret access key
required: true
aws-endpoint-url:
description: AWS endpoint URL
required: true
aws-region:
description: AWS region
required: false
default: us-east-1
aws-bucket:
description: S3 bucket for plan uploads
required: true
digger-version:
description: Version of digger to use (must match a release tag)
required: true

runs:
using: composite
steps:
- name: Setup OpenTofu
uses: opentofu/[email protected]
with:
tofu_version: ${{ inputs.opentofu-version }}
tofu_wrapper: false
- name: Download Digger Binary
uses: actions/github-script@v7
with:
script: |
const os = process.env.RUNNER_OS.toLowerCase();
const arch = process.env.RUNNER_ARCH.replace('X64', 'amd64').replace('ARM64', 'arm64');
const assetName = `digger-cli-${os}-${arch}${os === 'windows' ? '.exe' : ''}`;
const release = await github.rest.repos.getReleaseByTag({
owner: 'diggerhq',
repo: 'digger',
tag: process.env.DIGGER_VERSION
});
const asset = release.data.assets.find(a => a.name === assetName);
if (!asset) throw new Error(`Could not find asset: ${assetName}`);
const download = await github.rest.repos.getReleaseAsset({
owner: 'diggerhq',
repo: 'digger',
asset_id: asset.id,
headers: {
accept: 'application/octet-stream'
}
});
require('fs').writeFileSync('digger', Buffer.from(download.data));
require('fs').chmodSync('digger', '755');
env:
DIGGER_VERSION: ${{ inputs.digger-version }}

- name: Run Digger
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-secret-access-key }}
AWS_ENDPOINT_URL: ${{ inputs.aws-endpoint-url }}
AWS_REGION: ${{ inputs.aws-region }}
AWS_S3_BUCKET: ${{ inputs.aws-bucket }}
DIGGER_RUN_SPEC: ${{ inputs.digger-spec }}
run: ./digger

0 comments on commit eda6491

Please sign in to comment.