Skip to content

Commit

Permalink
Merge pull request #115 from opentofu/manual-gha
Browse files Browse the repository at this point in the history
  • Loading branch information
Yantrio authored Sep 2, 2024
2 parents f8b3cfa + 04c3cdb commit 635a20d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/generate-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Generate (manual)
permissions: {}
on:
workflow_dispatch:
inputs:
namespace:
description: "Namespace to regenerate"
required: true
type: string
name:
description: "Name of the provider or module to regenerate"
required: false
type: string
default: ""
target_system:
description: "Target system of the module to regenerate"
required: false
type: string
default: ""
force_regenerate:
type: string
required: false
default: ""
description: "Force regenerating a namespace, name, or target system. This parameter is a comma-separate list consisting of either a namespace, a namespace and a name separated by a /, or a namespace, name and target system separated by a /. Example: namespace/name/targetsystem,othernamespace/othername"
concurrency:
group: generate
cancel-in-progress: false
jobs:
generate:
name: Run generation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: 'backend/go.mod'
- name: Run generation
working-directory: backend
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_ENDPOINT_URL_S3: ${{secrets.AWS_ENDPOINT_URL_S3}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
S3_BUCKET: ${{secrets.S3_BUCKET}}
NAMESPACE: ${{inputs.namespace}}
NAME: ${{inputs.name}}
TARGET_SYSTEM: ${{inputs.target_system}}
FORCE_REGENERATE: ${{inputs.force_regenerate}}
run: |
go generate ./...
go run github.com/opentofu/registry-ui/cmd/generate --log-level=trace --s3-bucket=${S3_BUCKET} --blocklist ../blocklist.json --namespace="${NAMESPACE}" --name="${NAME}" --target-system="${TARGET_SYSTEM}" --force-regenerate="${FORCE_REGENERATE}"
4 changes: 3 additions & 1 deletion .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Generate
permissions: {}
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *" # Run every hour
concurrency:
group: generate
cancel-in-progress: false
jobs:
generate:
name: Run generation
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ the following secrets to be set up:
- `AWS_ENDPOINT_URL_S3`
- `S3_BUCKET`

Additionally, the `Generate (manual)` workflow allows you to manually trigger the generation for a namespace, name, or target system, including an option to force the regeneration from scratch.

## Frontend

In order to run the frontend, enter the [frontend](frontend) directory and run `npm run dev`. You can create a `.env`
Expand Down

0 comments on commit 635a20d

Please sign in to comment.