Skip to content

Commit 7eff021

Browse files
committed
Enhance GitHub Actions workflows by adding issue permissions in auto-merge dependabot configuration and refining label addition logic to only include existing labels. Update Trivy scan step to clarify its execution context as local docker.
1 parent 2292e2b commit 7eff021

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

.github/workflows/auto-merge-dependabot.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
permissions:
88
contents: write
99
pull-requests: write
10+
issues: write
1011

1112
jobs:
1213
automerge:
@@ -19,20 +20,19 @@ jobs:
1920
with:
2021
github-token: ${{ secrets.GITHUB_TOKEN }}
2122

22-
- name: Add labels
23+
- name: Add existing labels only
2324
uses: actions/github-script@v7
2425
with:
2526
script: |
26-
const labels = ['dependencies'];
27-
if (['version-update:semver-minor','version-update:semver-patch'].includes('${{ steps.meta.outputs.update-type }}')) {
28-
labels.push('automerge');
27+
const wanted = ['dependencies'];
28+
const { data: repoLabels } = await github.rest.issues.listLabelsForRepo({ owner: context.repo.owner, repo: context.repo.repo, per_page: 100 });
29+
const existing = new Set(repoLabels.map(l => l.name.toLowerCase()));
30+
const toAdd = wanted.filter(n => existing.has(n));
31+
if (toAdd.length) {
32+
await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.payload.pull_request.number, labels: toAdd });
33+
} else {
34+
core.info('No matching existing labels to add');
2935
}
30-
await github.rest.issues.addLabels({
31-
owner: context.repo.owner,
32-
repo: context.repo.repo,
33-
issue_number: context.payload.pull_request.number,
34-
labels,
35-
});
3636
3737
- name: Enable auto-merge (squash) for non-major updates
3838
if: steps.meta.outputs.update-type != 'version-update:semver-major'

.github/workflows/security.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ jobs:
4141
with:
4242
context: .
4343
push: false
44+
load: true
4445
tags: lcm:ci-scan
4546
build-args: |
4647
TORCH_INDEX_URL=https://download.pytorch.org/whl/cpu
47-
- name: Trivy scan image
48+
- name: Trivy scan image (local docker)
4849
id: trivy
4950
uses: aquasecurity/trivy-action@0.22.0
5051
with:

0 commit comments

Comments
 (0)