Skip to content

Commit

Permalink
fix: find issue on successful validation
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Mar 25, 2024
1 parent d5b837c commit 9161492
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/SGID_INDEX_ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: SGID Index Validation Issues
labels: sgid index validation
---

Validation errors have been detected in the [SGID Index](https://docs.google.com/spreadsheets/d/11ASS7LnxgpnD0jN4utzklREgMf1pcvYjcXcIcESHweQ/edit#gid=1024261148). This issue will be used to track the resolution of these issues.
Expand Down
27 changes: 23 additions & 4 deletions .github/workflows/schedule.sgid-index-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,37 @@ jobs:
filename: .github/SGID_INDEX_ISSUE_TEMPLATE.md
update_existing: true

- name: Find Open Issues
uses: actions/github-script@v4
id: find-issue
if: steps.validate.outputs.exitCode == 0
with:
script: |
const { data: issues } = await github.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'sgid index validation'
});
const issueNumber = issues[0].number;
console.log('issueNumber: ' + issueNumber);
return issueNumber;
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Find Comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ steps.create-issue.outputs.number }}
issue-number: ${{ steps.create-issue.outputs.number || steps.find-issue.outputs.result }}
comment-author: github-actions[bot]
body-includes: Validation Output

- name: ✍️ Updating issue comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.create-issue.outputs.number }}
issue-number: ${{ steps.create-issue.outputs.number || steps.find-issue.outputs.result }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: |
Expand All @@ -99,7 +118,7 @@ jobs:
exit ${{ steps.validate.outputs.exitCode }}
- name: 🎉 Close issue
if: steps.validate.outputs.exitCode == 0 && steps.create-issue.outputs.number
run: gh issue close --comment "Auto-closing issue" "${{ steps.create-issue.outputs.number }}"
if: steps.validate.outputs.exitCode == 0 && steps.find-issue.outputs.result
run: gh issue close --comment "All validations has passed successfully" "${{ steps.find-issue.outputs.result }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 9161492

Please sign in to comment.