From 9d9fcd4974f82deb9423659bc8e313c5cb06e3f9 Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Wed, 13 Mar 2024 10:27:33 -0400 Subject: [PATCH] chore: regenerates profiles after upstream updates for control diff (#78) Signed-off-by: Jennifer Power --- .github/workflows/regenerate-profile.yml | 41 ------------------------ .github/workflows/update-upstream.yml | 15 ++++++++- 2 files changed, 14 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/regenerate-profile.yml diff --git a/.github/workflows/regenerate-profile.yml b/.github/workflows/regenerate-profile.yml deleted file mode 100644 index 4a5053e..0000000 --- a/.github/workflows/regenerate-profile.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Regenerate profile content - -on: - push: - branches: - - main - paths: - - 'profiles/**' - - 'catalogs/**' - -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 profiles - id: regenerate - uses: RedHatProductSecurity/trestle-bot/actions/autosync@v0.7.2 - with: - markdown_path: "markdown/profiles" - oscal_model: "profile" - file_pattern: "markdown/*" - branch: "autoupdate-${{ github.run_id }}" - target_branch: "main" - skip_assemble: true - skip_items: "fedramp_rev5_high" - 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 }} diff --git a/.github/workflows/update-upstream.yml b/.github/workflows/update-upstream.yml index b052650..a3d2941 100644 --- a/.github/workflows/update-upstream.yml +++ b/.github/workflows/update-upstream.yml @@ -60,6 +60,7 @@ jobs: git config --global --add safe.directory "${GITHUB_WORKSPACE}" - name: Update content uses: peter-evans/create-pull-request@v5.0.2 + id: updates with: base: main branch: "oscal-update-${{ github.run_id }}" @@ -75,4 +76,16 @@ jobs: Auto-generated by the `update-upstream` workflow. add-paths: | "catalogs/${NIST_CATALOG_NAME}" - "profiles/${FEDRAMP_PROFILE_NAME}" \ No newline at end of file + "profiles/${FEDRAMP_PROFILE_NAME}" + - name: Regenerate profiles + if: ${{ steps.updates.outputs.pull-request-number }} + uses: RedHatProductSecurity/trestle-bot/actions/autosync@v0.7.2 + with: + markdown_path: "markdown/profiles" + oscal_model: "profile" + file_pattern: "markdown/*" + branch: "oscal-update-${{ github.run_id }}" + commit_message: Generating markdown changes [skip ci] + 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