Skip to content

Commit

Permalink
feat(action): prep for multiple actions
Browse files Browse the repository at this point in the history
Related: PSCE-243
Signed-off-by: Alex Flom <[email protected]>
  • Loading branch information
afflom committed Oct 5, 2023
1 parent fb1ad0b commit 7c65945
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,8 @@ cat my-token.txt | podman secret create repo-secret -

```bash
podman run --entrypoint /entrypoint.sh --secret repo-secret,type=env,target=GITHUB_TOKEN --env-file=envfile -v my-trestle-space:/data -w /data localhost:5000/trestlebot:latest
```
```

### Adding a new action

First, create an entrypoint script for the new action in the `trestlebot/infra` directory. Then add the action by creating a new directory in the `actions` directory with an `action.yml` that references your new entrypoint.
91 changes: 91 additions & 0 deletions actions/trestle-bot/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: "trestle-bot"
author: "Red Hat Product Security"
description: "A workflow automation manager for OSCAL formatted compliance content"

inputs:
markdown_path:
description: Path relative to the repository path where the Trestle markdown files are located. See project README.md for more information.
required: true
oscal_model:
description: OSCAL Model type to assemble. Values can be catalog, profile, compdef, or ssp.
required: true
check_only:
description: "Runs tasks and exits with an error if there is a diff. Defaults to false"
required: false
default: "false"
github_token:
description: "GitHub token used to make authenticated API requests"
required: false
skip_assemble:
description: "Skip assembly task. Defaults to false"
required: false
default: "false"
skip_regenerate:
description: "Skip regenerate task. Defaults to false."
required: false
default: "false"
skip_items:
description: "Comma-separated glob patterns list of content by Trestle name to skip during task execution. For example `profile_x,profile_y*,`."
required: false
ssp_index_path:
description: Path relative to the repository path where the ssp index is located. See project README.md for information about the ssp index.
required: false
default: "ssp-index.json"
commit_message:
description: Commit message
required: false
default: "Sync automatic updates"
pull_request_title:
description: Custom pull request title
required: false
default: "Automatic updates from trestlebot"
branch:
description: Name of the Git branch to which modifications should be pushed. Required if Action is used on the `pull_request` event.
required: false
default: ${{ github.ref_name }}
target_branch:
description: Target branch (or base branch) to create a pull request against. If unset, no pull request will be created. If set, a pull request will be created using the `branch` field as the head branch.
required: false
file_pattern:
description: Comma separated file pattern list used for `git add`. For example `component-definitions/*,*json`. Defaults to (`.`)
required: false
default: '.'
repository:
description: Local file path to the git repository. Defaults to the current directory (`.`)
required: false
default: '.'
commit_user_name:
description: Name used for the commit user
required: false
default: github-actions[bot]
commit_user_email:
description: Email address used for the commit user
required: false
default: 41898282+github-actions[bot]@users.noreply.github.com
commit_author_name:
description: Name used for the commit author. Defaults to the username of whoever triggered this workflow run.
required: false
default: ${{ github.actor }}
commit_author_email:
description: Email address used for the commit author. Defaults to the email of whoever triggered this workflow run.
required: false
default: ${{ github.actor }}@users.noreply.github.com

outputs:
changes:
description: Value is "true" if changes were committed back to the repository.
commit:
description: Full hash of the created commit. Only present if the "changes" output is "true".
pr_number:
description: Number of the submitted pull request. Only present if a pull request is submitted.

runs:
using: "docker"
image: "Dockerfile"
entrypoint: "/entrypoint.sh"
env:
GITHUB_TOKEN: ${{ inputs.github_token }}

branding:
icon: "check"
color: "green"
31 changes: 31 additions & 0 deletions trestlebot/infra/entrypoints/create.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2023 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Create OSCAL content."""

import sys


def create_entrypoint():
"""Creates specified OSCAL formatted content."""
pass


def main():

return create_entrypoint()


if __name__ == '__main__':
sys.exit(main())

0 comments on commit 7c65945

Please sign in to comment.