Skip to content

Commit

Permalink
updated workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerMizuyabu committed Apr 3, 2024
1 parent 8c95e1d commit 9d79739
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions organizations/.github/workflows/drift-detection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,40 @@ jobs:
</details>`;
const date = new Date();
github.rest.issues.create({
const issues = (await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Drift Detected ${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`,
body: output,
labels: [drift_label, action_required_label]
})
labels: drift_label,
sort: 'created',
direction: 'desc',
per_page: 1
})).data;
if (issues.length == 0) {
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Drift Detected',
body: output,
labels: [drift_label, action_required_label]
});
}else {
github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issues[0].number,
body: output,
labels: [drift_label, action_required_label]
});
}
re-run-apply:
permissions:
contents: 'read'
id-token: 'write'
pull-requests: 'write'
issues: 'write'
name: "Run Drift Detection"
name: "Run Apply"
if: github.event_name == 'issues' && github.event.action == 'labeled' && github.event.label.name == 'Re-Apply'
runs-on: ubuntu-latest
defaults:
Expand Down

0 comments on commit 9d79739

Please sign in to comment.