From dfd754babeb12c0f4cc6339b4f44b3ae08fe304b Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Wed, 6 Mar 2024 16:01:22 -0500 Subject: [PATCH 1/5] chore: moves regeneration tasks to workflow location where the diff can be utilized --- .github/workflows/regenerate-cd.yml | 40 --------------------------- .github/workflows/transform-rules.yml | 10 +++++++ .github/workflows/update-profiles.yml | 11 ++++++++ 3 files changed, 21 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..a981d59 100644 --- a/.github/workflows/transform-rules.yml +++ b/.github/workflows/transform-rules.yml @@ -37,4 +37,14 @@ jobs: file_pattern: "*.json,rules/*" branch: ${{ inputs.branch }} 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_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..c143369 100644 --- a/.github/workflows/update-profiles.yml +++ b/.github/workflows/update-profiles.yml @@ -32,3 +32,14 @@ jobs: github_token: ${{ steps.get_installation_token.outputs.token }} sources: | https://github.com/RedHatProductSecurity/oscal-profiles@main + - name: Regenerate component definitions + id: regenerate + uses: RedHatProductSecurity/trestle-bot/actions/autosync@v0.7.1 + with: + markdown_path: "markdown/components" + oscal_model: "compdef" + file_pattern: "markdown/*" + branch: "sync-upstream-${{ github.run_id }}" + skip_assemble: true + commit_user_name: "trestle-bot[bot]" + commit_user_email: "136850459+trestle-bot[bot]@users.noreply.github.com" From 0658677cb7049e83498a901e78658d663d99e16f Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Tue, 12 Mar 2024 16:45:49 -0400 Subject: [PATCH 2/5] chore: adds custom commit messages and check for changes --- .github/workflows/transform-rules.yml | 2 ++ .github/workflows/update-profiles.yml | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/transform-rules.yml b/.github/workflows/transform-rules.yml index a981d59..a957a6c 100644 --- a/.github/workflows/transform-rules.yml +++ b/.github/workflows/transform-rules.yml @@ -36,6 +36,7 @@ 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 @@ -46,5 +47,6 @@ jobs: 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 c143369..f302c76 100644 --- a/.github/workflows/update-profiles.yml +++ b/.github/workflows/update-profiles.yml @@ -33,7 +33,7 @@ jobs: sources: | https://github.com/RedHatProductSecurity/oscal-profiles@main - name: Regenerate component definitions - id: regenerate + if: ${{ steps.sync_upstreams.outputs.changes }} uses: RedHatProductSecurity/trestle-bot/actions/autosync@v0.7.1 with: markdown_path: "markdown/components" @@ -41,5 +41,6 @@ jobs: 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" From 3760360bd0a96ae3afa6855abf05a78e53e4a498 Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Tue, 12 Mar 2024 17:45:49 -0400 Subject: [PATCH 3/5] fix: add id to sync upstreams job --- .github/workflows/update-profiles.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-profiles.yml b/.github/workflows/update-profiles.yml index f302c76..d254679 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 }}" From e7b5dc850eef110aab65ebf34ec4395754ef3828 Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Tue, 12 Mar 2024 18:04:53 -0400 Subject: [PATCH 4/5] fix: updates 'changes' to 'commit' to check sync step --- .github/workflows/update-profiles.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-profiles.yml b/.github/workflows/update-profiles.yml index d254679..e6afd30 100644 --- a/.github/workflows/update-profiles.yml +++ b/.github/workflows/update-profiles.yml @@ -34,7 +34,7 @@ jobs: sources: | https://github.com/RedHatProductSecurity/oscal-profiles@main - name: Regenerate component definitions - if: ${{ steps.sync_upstreams.outputs.changes }} + if: ${{ steps.sync_upstreams.outputs.commit }} uses: RedHatProductSecurity/trestle-bot/actions/autosync@v0.7.1 with: markdown_path: "markdown/components" From 6d1a52aee61f6a0875f2474386e05921e9b778f7 Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Tue, 12 Mar 2024 18:05:35 -0400 Subject: [PATCH 5/5] chore: bumps regeneration step to version 0.7.2 --- .github/workflows/update-profiles.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-profiles.yml b/.github/workflows/update-profiles.yml index e6afd30..66e4703 100644 --- a/.github/workflows/update-profiles.yml +++ b/.github/workflows/update-profiles.yml @@ -35,7 +35,7 @@ jobs: 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.1 + uses: RedHatProductSecurity/trestle-bot/actions/autosync@v0.7.2 with: markdown_path: "markdown/components" oscal_model: "compdef"