Skip to content

Commit

Permalink
Update upstream corpus test modification workflow to open an issue on…
Browse files Browse the repository at this point in the history
…ly if one doesn't already exist
  • Loading branch information
patjakdev committed Sep 10, 2024
1 parent cfe8c09 commit 10a3543
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/corpus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
# push:

jobs:
build:
Check-Upstream:
defaults:
run:
shell: bash
Expand All @@ -23,16 +23,28 @@ jobs:
run: cmp /tmp/corpus-tests.tar.gz corpus-tests.tar.gz

- name: Notify on Failure
if: failure() && github.event_name == 'schedule'
uses: actions/github-script@v6
#if: failure() && github.event_name == 'schedule'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.create({
// Get a list of all open issues called 'Upstream Integration Test Corpus Modified'
const issues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Upstream Integration Test Corpus Modified',
body: 'The upstream integration test corpus at https://raw.githubusercontent.com/cedar-policy/cedar-integration-tests/main/corpus-tests.tar.gz has been updated. Please integrate the changes into the local copy.'
assignees: ['jmccarthy', 'philhassey', 'patjakdev'],
labels: ['bug']
title: 'Upstream Integration Test Corpus Modified'
})
.then((issues) => {
console.log(`Found ${issues.length} open issues: ${issues[0].title}`)
// If one doesn't exist, create it
if (issues.length === 0) {
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Upstream Integration Test Corpus Modified',
body: 'The upstream integration test corpus at https://raw.githubusercontent.com/cedar-policy/cedar-integration-tests/main/corpus-tests.tar.gz has been updated. Please integrate the changes into the local copy.',
assignees: ['jmccarthy', 'philhassey', 'patjakdev'],
labels: ['bug']
})
}
});

0 comments on commit 10a3543

Please sign in to comment.