From 029f226f751e8d146bd504bd732062b1271048de Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Wed, 13 Mar 2024 10:25:50 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20moves=20regeneration=20tasks=20to=20wo?= =?UTF-8?q?rkflow=20location=20where=20the=20diff=20c=E2=80=A6=20(#80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: moves regeneration tasks to workflow location where the diff can be utilized * chore: adds custom commit messages and check for changes * fix: add id to sync upstreams job * fix: updates 'changes' to 'commit' to check sync step * chore: bumps regeneration step to version 0.7.2 --- .github/workflows/regenerate-cd.yml | 40 --------------------------- .github/workflows/transform-rules.yml | 12 ++++++++ .github/workflows/update-profiles.yml | 13 +++++++++ 3 files changed, 25 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/regenerate-cd.yml diff --git a/.github/workflows/regenerate-cd.yml b/.github/workflows/regenerate-cd.yml deleted file mode 100644 index 6889526..0000000 --- a/.github/workflows/regenerate-cd.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Regenerate component definition content -on: - push: - branches: - - main - paths: - - 'profiles/**' - - 'catalogs/**' - - 'component-definitions/**' - -jobs: - update: - name: Regenerate content - runs-on: ubuntu-latest - steps: - - name: Generate app token - uses: tibdex/github-app-token@v2.1.0 - 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@v4 - with: - token: ${{ steps.get_installation_token.outputs.token }} - - name: Regenerate component definitions - id: regenerate - uses: RedHatProductSecurity/trestle-bot/actions/autosync@v0.7.2 - with: - markdown_path: "markdown/components" - oscal_model: "compdef" - file_pattern: "markdown/*" - branch: "autoupdate-${{ github.run_id }}" - target_branch: "main" - 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 }} \ No newline at end of file diff --git a/.github/workflows/transform-rules.yml b/.github/workflows/transform-rules.yml index 6d46187..a957a6c 100644 --- a/.github/workflows/transform-rules.yml +++ b/.github/workflows/transform-rules.yml @@ -36,5 +36,17 @@ jobs: with: file_pattern: "*.json,rules/*" branch: ${{ inputs.branch }} + commit_message: "Transform rules to OSCAL [skip-ci]" + commit_user_name: "trestle-bot[bot]" + commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com" + - name: Regenerate component definitions + uses: RedHatProductSecurity/trestle-bot/actions/autosync@v0.7.1 + with: + markdown_path: "markdown/components" + oscal_model: "compdef" + file_pattern: "markdown/*" + branch: ${{ inputs.branch }} + skip_assemble: true + commit_message: "Generate markdown changes [skip-ci]" commit_user_name: "trestle-bot[bot]" commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com" \ No newline at end of file diff --git a/.github/workflows/update-profiles.yml b/.github/workflows/update-profiles.yml index a641941..66e4703 100644 --- a/.github/workflows/update-profiles.yml +++ b/.github/workflows/update-profiles.yml @@ -21,6 +21,7 @@ jobs: with: token: ${{ steps.get_installation_token.outputs.token }} - name: Update from upstream repo + id: sync_upstreams uses: RedHatProductSecurity/trestle-bot/actions/sync-upstreams@v0.7.2 with: branch: "sync-upstream-${{ github.run_id }}" @@ -32,3 +33,15 @@ jobs: github_token: ${{ steps.get_installation_token.outputs.token }} sources: | https://github.com/RedHatProductSecurity/oscal-profiles@main + - name: Regenerate component definitions + if: ${{ steps.sync_upstreams.outputs.commit }} + uses: RedHatProductSecurity/trestle-bot/actions/autosync@v0.7.2 + with: + markdown_path: "markdown/components" + oscal_model: "compdef" + file_pattern: "markdown/*" + branch: "sync-upstream-${{ github.run_id }}" + skip_assemble: true + commit_message: "Generate markdown changes [skip ci]" + commit_user_name: "trestle-bot[bot]" + commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com"