Skip to content

CLOUDP-330556: Auto merge compliance report #4053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 15 additions & 76 deletions .github/workflows/update-ssdlc-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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: |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to add a third-party dependency. What is the value of it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something we dont' need to maintain and should be a bit more reliable - also we already use it in other codebases. no string opinion though

Copy link
Collaborator Author

@fmenezes fmenezes Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather avoid the dependency. Especially the security problem we almost had on the verify-changed-files action. I think calling git commands makes it very clear what is going on.

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
Loading