mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-06 16:00:28 +01:00
Update main.yml
This commit is contained in:
parent
27ff4e63b6
commit
cafe9e9c11
42
.github/workflows/main.yml
vendored
42
.github/workflows/main.yml
vendored
@ -1,5 +1,3 @@
|
|||||||
name: Docker Image Build and Analysis
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *" # Schedule the workflow to run daily at midnight (UTC time). Adjust the time if needed.
|
- cron: "0 0 * * *" # Schedule the workflow to run daily at midnight (UTC time). Adjust the time if needed.
|
||||||
@ -63,43 +61,3 @@ jobs:
|
|||||||
command: cves
|
command: cves
|
||||||
image: ${{ steps.meta.outputs.tags }}
|
image: ${{ steps.meta.outputs.tags }}
|
||||||
exit-code: true
|
exit-code: true
|
||||||
|
|
||||||
- name: Create build summary
|
|
||||||
if: ${{ always() }}
|
|
||||||
uses: actions/github-script@v6
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
const summary = `
|
|
||||||
### Docker Image Build and Analysis Summary
|
|
||||||
|
|
||||||
- **Image Name:** ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
- **Commit SHA:** ${{ env.SHA }}
|
|
||||||
- **Build Status:** ${{ job.status }}
|
|
||||||
- **Docker Scout Results:**
|
|
||||||
- **CVE Analysis:** ${{ steps.docker-scout.outputs.result || 'No results' }}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const comment = {
|
|
||||||
body: summary
|
|
||||||
};
|
|
||||||
|
|
||||||
if (process.env.GITHUB_EVENT_NAME === 'pull_request') {
|
|
||||||
const prNumber = process.env.GITHUB_REF.split('/')[2];
|
|
||||||
await github.rest.issues.createComment({
|
|
||||||
issue_number: prNumber,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
...comment
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await github.rest.repos.createCommitStatus({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
sha: process.env.GITHUB_SHA,
|
|
||||||
state: job.status === 'success' ? 'success' : 'failure',
|
|
||||||
description: 'Docker image build and analysis complete',
|
|
||||||
context: 'docker-build'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user