Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
38475a4
Create notify-dependabot.yml
MuHamza30 May 26, 2025
c483cf0
Update notify-dependabot.yml
MuHamza30 May 26, 2025
6cccbd2
Update notify-dependabot.yml
MuHamza30 May 26, 2025
021ed86
Update notify-dependabot.yml
MuHamza30 May 26, 2025
7c0782b
Update APIMatic.Core.csproj
MuHamza30 May 26, 2025
c92a3da
Update dependabot.yml
MuHamza30 May 26, 2025
4c6968b
Create notify-dependabot.yml
MuHamza30 May 26, 2025
e6c19ba
Delete .github/notify-dependabot.yml
MuHamza30 May 26, 2025
fedbcab
Update notify-dependabot.yml
MuHamza30 May 26, 2025
e31df96
Update notify-dependabot.yml
MuHamza30 May 26, 2025
a60a4c2
Update notify-dependabot.yml
MuHamza30 May 26, 2025
534c19c
Update notify-dependabot.yml
MuHamza30 May 26, 2025
e4d8cf0
Update notify-dependabot.yml
MuHamza30 May 26, 2025
762e2c1
Update notify-dependabot.yml
MuHamza30 May 26, 2025
3815d0b
Update notify-dependabot.yml
MuHamza30 May 26, 2025
0a5be8b
Update notify-dependabot.yml
MuHamza30 May 26, 2025
0e0fade
Update notify-dependabot.yml
MuHamza30 May 26, 2025
4d23050
Update notify-dependabot.yml
MuHamza30 May 26, 2025
7382c33
Update notify-dependabot.yml
MuHamza30 May 26, 2025
95ecb9c
Update notify-dependabot.yml
MuHamza30 May 26, 2025
9523d12
Update notify-dependabot.yml
MuHamza30 May 26, 2025
c979f76
Update notify-dependabot.yml
MuHamza30 May 26, 2025
e34bead
Update notify-dependabot.yml
MuHamza30 May 26, 2025
17f8352
Update notify-dependabot.yml
MuHamza30 May 26, 2025
e1fc8e1
Update notify-dependabot.yml
MuHamza30 May 26, 2025
75ceca3
Update notify-dependabot.yml
MuHamza30 May 26, 2025
34623f1
Update notify-dependabot.yml
MuHamza30 May 26, 2025
bdf2195
Update notify-dependabot.yml
MuHamza30 May 26, 2025
a1c4f6c
Update notify-dependabot.yml
MuHamza30 May 26, 2025
6736102
Update notify-dependabot.yml
MuHamza30 May 26, 2025
6d8cd4f
Update notify-dependabot.yml
MuHamza30 May 26, 2025
d52446c
Update notify-dependabot.yml
MuHamza30 May 26, 2025
08392cd
Update notify-dependabot.yml
MuHamza30 May 26, 2025
01f2538
Update notify-dependabot.yml
MuHamza30 May 26, 2025
464b973
Update notify-dependabot.yml
MuHamza30 May 26, 2025
27e3af7
Update notify-dependabot.yml
MuHamza30 May 26, 2025
9443422
Update notify-dependabot.yml
MuHamza30 May 26, 2025
e505fe7
Update notify-dependabot.yml
MuHamza30 May 26, 2025
ff28dbf
Update notify-dependabot.yml
MuHamza30 May 26, 2025
4c09c12
Create run-checks.yml
MuHamza30 May 27, 2025
9693b1c
Update notify-dependabot.yml
MuHamza30 May 27, 2025
1c2a71b
Delete .github/workflows/run-checks.yml
MuHamza30 May 27, 2025
3596a51
Update notify-dependabot.yml
MuHamza30 May 27, 2025
16e2d79
Update notify-dependabot.yml
MuHamza30 May 27, 2025
8a42036
Update notify-dependabot.yml
MuHamza30 May 27, 2025
0e95805
Update notify-dependabot.yml
MuHamza30 May 27, 2025
d0471a1
Update notify-dependabot.yml
MuHamza30 May 27, 2025
eb56c46
Update notify-dependabot.yml
MuHamza30 May 27, 2025
b138aaf
Update notify-dependabot.yml
MuHamza30 May 27, 2025
e970d4b
Update notify-dependabot.yml
MuHamza30 May 27, 2025
ca108b6
Update notify-dependabot.yml
MuHamza30 May 27, 2025
40ce35c
Update notify-dependabot.yml
MuHamza30 May 27, 2025
58c7142
Update notify-dependabot.yml
MuHamza30 May 27, 2025
14575e2
Update notify-dependabot.yml
MuHamza30 May 27, 2025
ce69cab
Update notify-dependabot.yml
MuHamza30 May 27, 2025
8bbd44e
Update notify-dependabot.yml
MuHamza30 May 27, 2025
ea8276c
Update notify-dependabot.yml
MuHamza30 May 27, 2025
6749d8a
Update notify-dependabot.yml
MuHamza30 May 27, 2025
6a32c3b
Update notify-dependabot.yml
MuHamza30 May 27, 2025
22c6275
Update notify-dependabot.yml
MuHamza30 May 27, 2025
4794c5a
Update notify-dependabot.yml
MuHamza30 May 27, 2025
f307628
Update notify-dependabot.yml
MuHamza30 May 27, 2025
604d78b
Update notify-dependabot.yml
MuHamza30 May 27, 2025
bdbf9e8
Update notify-dependabot.yml
MuHamza30 May 27, 2025
38be400
Update notify-dependabot.yml
MuHamza30 May 27, 2025
d700b5b
Update notify-dependabot.yml
MuHamza30 May 27, 2025
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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ updates:
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "monthly"
interval: "daily"
labels:
- "dependency update"
commit-message:
Expand Down
124 changes: 124 additions & 0 deletions .github/workflows/notify-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Dependabot Notifications

on:
workflow_run:
workflows: ["*"]
types:
- completed

jobs:
notify-checks:
runs-on: ubuntu-latest

if: github.actor == 'dependabot[bot]'
steps:
- name: Get PR Information
id: get-pr-info
uses: actions/github-script@v6
with:
script: |
const { owner, repo } = context.repo;
const run = context.payload.workflow_run;

// Get PR directly from the workflow run's head SHA
const response = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner,
repo,
commit_sha: run.head_sha
});

const pr = response.data[0]; // Get the first associated PR

if (pr) {
core.exportVariable('PR_TITLE', pr.title);
core.exportVariable('PR_AUTHOR', pr.user.login);
core.exportVariable('PR_LINK', pr.html_url);
core.exportVariable('PR_NUMBER', pr.number.toString());
} else {
core.exportVariable('PR_TITLE', 'Unknown');
core.exportVariable('PR_AUTHOR', context.actor);
core.exportVariable('PR_LINK', `https://github.com/${owner}/${repo}/pulls`);
core.exportVariable('PR_NUMBER', '');
}

// Get check runs for this commit
const checkRuns = await github.rest.checks.listForRef({
owner,
repo,
ref: run.head_sha
});

// Count different check conclusions
const stats = checkRuns.data.check_runs.reduce((acc, check) => {
acc[check.conclusion] = (acc[check.conclusion] || 0) + 1;
return acc;
}, {});

// Create status summary
const summary = Object.entries(stats)
.map(([status, count]) => `${count} ${status}`)
.join(', ');

core.exportVariable('CHECKS_SUMMARY', summary);

// Determine overall status
const hasFailures = stats.failure > 0;
const hasSuccess = stats.success > 0;
const hasCancelled = stats.cancelled > 0;

let overallStatus;
if (hasFailures) {
overallStatus = 'failure';
} else if (hasCancelled && !hasSuccess) {
overallStatus = 'cancelled';
} else if (hasSuccess) {
overallStatus = 'success';
} else {
overallStatus = 'unknown';
}

// Only set status if this is the last workflow to complete
const incompleteRuns = await github.rest.actions.listWorkflowRunsForRepo({
owner,
repo,
head_sha: run.head_sha,
status: 'in_progress'
});

if (incompleteRuns.data.total_count === 0) {
core.exportVariable('ALL_CHECKS_STATUS', overallStatus);
core.exportVariable('SHOULD_NOTIFY', 'true');

// If checks failed and PR exists, close it
if ((overallStatus === 'failure' || overallStatus === 'cancelled') && pr) {
await github.rest.pulls.update({
owner,
repo,
pull_number: pr.number,
state: 'closed'
});

// Add comment explaining why PR was closed
await github.rest.issues.createComment({
owner,
repo,
issue_number: pr.number,
body: `This PR was automatically closed because some checks failed.\nStatus Summary: ${summary}`
});
}
} else {
core.exportVariable('SHOULD_NOTIFY', 'false');
}

- name: Send Slack Notification for Success
if: env.SHOULD_NOTIFY == 'true' && env.ALL_CHECKS_STATUS == 'success'
uses: slackapi/slack-github-action@v1.25.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
payload: |
{
"text": "Repository: ${{ github.repository }}\nTitle: ${{ env.PR_TITLE }}\nAuthor: ${{ env.PR_AUTHOR }}\nLink: ${{ env.PR_LINK }}\nStatus Summary: ${{ env.CHECKS_SUMMARY }}",
"username": "PR Checks Monitor",
"icon_emoji": ":robot_face:"
}
2 changes: 1 addition & 1 deletion APIMatic.Core/APIMatic.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="[13.0.1,)" />
<PackageReference Include="Newtonsoft.Json" Version="[12.0.1,)" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="APIMatic.Core.Test" />
Expand Down
Loading