From fc1c7213d0b837ff22ece28b817c1e75dad9dea1 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 23 Jul 2025 15:24:09 +0100 Subject: [PATCH] CLOUDP-330556: Auto merge compliance report --- .github/workflows/update-ssdlc-report.yaml | 91 ++++------------------ 1 file changed, 15 insertions(+), 76 deletions(-) diff --git a/.github/workflows/update-ssdlc-report.yaml b/.github/workflows/update-ssdlc-report.yaml index e2b520f39f..f1fd80380d 100644 --- a/.github/workflows/update-ssdlc-report.yaml +++ b/.github/workflows/update-ssdlc-report.yaml @@ -17,8 +17,17 @@ jobs: - uses: GitHubSecurityLab/actions-permissions/monitor@v1 with: config: ${{ vars.PERMISSIONS_CONFIG }} + - name: set Apix Bot token + id: app-token + uses: mongodb/apix-action/token@3024080388613583e3bd119bfb1ab4b4dbf43c42 + with: + app-id: ${{ secrets.APIXBOT_APP_ID }} + private-key: ${{ secrets.APIXBOT_APP_PEM }} - name: Checkout uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + ref: master - name: Extract AUTHOR and VERSION id: extract run: | @@ -40,79 +49,9 @@ jobs: VERSION: ${{ steps.extract.outputs.version }} AUGMENTED_REPORT: "false" run: ./build/package/gen-ssdlc-report.sh - - name: set Apix Bot token - id: app-token - uses: mongodb/apix-action/token@3024080388613583e3bd119bfb1ab4b4dbf43c42 - with: - app-id: ${{ secrets.APIXBOT_APP_ID }} - private-key: ${{ secrets.APIXBOT_APP_PEM }} - - name: Find JIRA ticket - id: find - uses: mongodb/apix-action/find-jira@3024080388613583e3bd119bfb1ab4b4dbf43c42 - with: - token: ${{ secrets.JIRA_API_TOKEN }} - jql: project = CLOUDP AND status NOT IN (Closed, Resolved) AND summary ~ "Update Compliance Report" - - name: Set JIRA ticket (find) - if: steps.find.outputs.found == 'true' - run: | - echo "JIRA_KEY=${{steps.find.outputs.issue-key}}" >> "$GITHUB_ENV" - - name: Create JIRA ticket - uses: mongodb/apix-action/create-jira@3024080388613583e3bd119bfb1ab4b4dbf43c42 - id: create - if: steps.find.outputs.found == 'false' - with: - token: ${{ secrets.JIRA_API_TOKEN }} - project-key: CLOUDP - summary: "[AtlasCLI] Update Compliance Report" - issuetype: Story - description: Update Compliance Report - components: AtlasCLI - assignee: ${{ secrets.ASSIGNEE_JIRA_TICKET }} - extra-data: | - { - "fields": { - "fixVersions": [ - { - "id": "41805" - } - ], - "customfield_12751": [ - { - "id": "22223" - } - ], - "customfield_10257": { - "id": "11861" - } - } - } - - name: Set JIRA ticket (create) - if: steps.find.outputs.found == 'false' - run: | - echo "JIRA_KEY=${{steps.create.outputs.issue-key}}" >> "$GITHUB_ENV" - - uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e - id: pr - with: - token: ${{ steps.app-token.outputs.token }} - committer: "${{ steps.app-token.outputs.user-name }} <${{ steps.app-token.outputs.user-email }}>" - author: "${{ steps.app-token.outputs.user-name }} <${{ steps.app-token.outputs.user-email }}>" - title: "${{ env.JIRA_KEY }}: Update compliance report for v${{ steps.extract.outputs.version }}" - commit-message: "${{ env.JIRA_KEY }}: Update compliance report for v${{ steps.extract.outputs.version }}" - delete-branch: true - base: master - branch: ${{ env.JIRA_KEY }} - labels: | - compliance - auto_close_jira - body: | - ## Proposed changes - Update compliance report for v${{ steps.extract.outputs.version }} - _Jira ticket:_ ${{ env.JIRA_KEY }} - - Note: Jira ticket will be closed automatically when this PR is merged. - - - name: Set auto merge - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: | - gh pr merge "${{ steps.pr.outputs.pull-request-url }}" --auto --squash + - run: | + git config user.name "${{ steps.app-token.outputs.user-name }}" + git config user.email "${{ steps.app-token.outputs.user-email }}" + git add . + git commit -m "Update compliance report for v${{ steps.extract.outputs.version }}" + git push