Skip to content

Component Definitions Create #4

Component Definitions Create

Component Definitions Create #4

Workflow file for this run

name: Component Definitions Create
on:
workflow_dispatch:
inputs:
import_name:
required: true
description: Name of profile in trestle workspace to be imported
output:
required: true
description: Name of the component definition to create
component_name:
required: true
description: Name of the component in the generated component definition
component_description:
required: true
description: Description of the component in the generated component definition
jobs:
create-component:
name: Create component definition
runs-on: ubuntu-latest
steps:
- name: Generate app token
uses: tibdex/github-app-token@v1
id: get_installation_token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
permissions: >-
{"contents": "write", "pull_requests": "write"}
- name: Clone
uses: actions/checkout@v3
with:
token: ${{ steps.get_installation_token.outputs.token }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
run: make trestlebot-install
- name: Create new component definition with imports
run: |
python3 scripts/set_default_comp.py --profile_name "${IMPORT_NAME}" \
--compdef_name "${OUTPUT}" --comp_title "${COMP_NAME}" --comp_description "${COMP_DESCRIPTION}" --trestle_root .
env:
OUTPUT: ${{ github.event.inputs.output }}
IMPORT_NAME: ${{ github.event.inputs.import_name }}
COMP_NAME: ${{ github.event.inputs.component_name }}
COMP_DESCRIPTION: ${{ github.event.inputs.component_description }}
- name: Generate and PR new component definition
id: generate-cd
uses: RedHatProductSecurity/trestle-bot@main
with:
markdown_path: "markdown/components"
oscal_model: "compdef"
branch: "component-create-${{ github.run_id }}"
target_branch: "main"
file_pattern: "*.json,markdown/*"
skip_assemble: true
commit_user_name: "trestle-bot[bot]"
commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"
github_token: ${{ steps.get_installation_token.outputs.token }}