Skip to content
Closed
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions .github/workflows/add-pr-to-devops.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Add PR to DevOps Board

on:
pull_request:
types: [opened, reopened]
branches: [main, master]

jobs:
add_to_project:
runs-on: ubuntu-latest
if: |
github.event.pull_request.base.ref == 'main' ||
github.event.pull_request.base.ref == 'master'
permissions:
contents: read
pull-requests: write
repository-projects: write
organization-projects: write
steps:
- name: Add PR to DevOps Release Board
uses: actions/[email protected]
with:
project-url: https://github.com/orgs/dhwani-ris/projects/##
github-token: ${{ secrets.GITHUB_TOKEN }}

7 changes: 4 additions & 3 deletions .github/workflows/auto-reviewer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Auto Request Review

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
types: [opened, synchronize, reopened, ready_for_review, closed]
branches: [master]

permissions:
pull-requests: write
Expand All @@ -13,8 +14,8 @@ jobs:
name: Request Review from Default Reviewer
runs-on: ubuntu-latest
if: |
github.event.pull_request.base.ref == 'main' ||
github.event.pull_request.base.ref == 'master'
(github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' || github.event.action == 'ready_for_review') &&
(github.event.pull_request.base.ref == 'main' || github.event.pull_request.base.ref == 'master')

steps:
- name: Request review from default reviewer
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/bot-handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
issue_comment:
types: [created, edited]
pull_request:
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened, closed]
branches: [master]

permissions:
contents: write
Expand Down
124 changes: 124 additions & 0 deletions .github/workflows/devops-checklist-submit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: DevOps Checklist Submission

on:
issue_comment:
types: [created]

permissions:
pull-requests: write
contents: read

jobs:
submit-checklist:
runs-on: ubuntu-latest
if: |
github.event.issue.pull_request &&
contains(github.event.comment.body, '/submit-checklist')
steps:
- name: Get PR number
id: get-pr
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = context.payload.issue.number;
core.setOutput('pr_number', prNumber);
return prNumber;

- name: Submit and lock checklist
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = context.payload.issue.number;
const submitter = context.payload.comment.user.login;
const submitTime = new Date().toISOString();
const submitDate = new Date().toLocaleString('en-US', {
timeZone: 'UTC',
year: 'numeric',
month: 'long',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
timeZoneName: 'short'
});

// Get all comments to find the checklist
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});

const checklistComment = comments.data.find(
comment => comment.user.type === 'Bot' &&
comment.body.includes('DevOps Checklist - Workflow Review')
);

if (!checklistComment) {
console.log('Checklist comment not found');
return;
}

// Check if already submitted
if (checklistComment.body.includes('✅ **CHECKLIST SUBMITTED**')) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `⚠️ This checklist has already been submitted and cannot be modified.`
});
return;
}

// Extract the current checklist content (preserve checkboxes)
let checklistBody = checklistComment.body;

// Replace the submission section with submitted status
const submittedSection = `---

### ✅ **CHECKLIST SUBMITTED**

**Submitted by:** @${submitter}
**Submitted at:** ${submitDate} (UTC)

🔒 **This checklist is now locked and cannot be modified.**

---
**Note:** This checklist was submitted and is final. No further changes can be made.`;

// Find and replace the submission section
// Look for the "Submit Checklist" section and replace everything from there to the end
const submitSectionStart = checklistBody.indexOf('### 📤 Submit Checklist');
if (submitSectionStart !== -1) {
// Keep everything before the submission section, then add the submitted section
checklistBody = checklistBody.substring(0, submitSectionStart) + submittedSection;
} else {
// If section not found, append the submitted section
checklistBody = checklistBody + '\n\n' + submittedSection;
}

// Update the checklist comment to show it's submitted
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: checklistComment.id,
body: checklistBody
});

// Add a confirmation comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `✅ **Checklist submitted successfully!**

The DevOps Checklist has been locked and cannot be modified.

**Submitted by:** @${submitter}
**Time:** ${submitDate} (UTC)`
});

console.log(`Checklist submitted by ${submitter} at ${submitTime}`);

Loading
Loading