-
Notifications
You must be signed in to change notification settings - Fork 10
54 lines (49 loc) · 2.1 KB
/
corpus.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Check For Integration Test Corpus Updates
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
Check-Upstream:
defaults:
run:
shell: bash
runs-on: ubuntu-latest
if: github.repository == 'cedar-policy/cedar-go'
permissions:
issues: write
steps:
- uses: actions/checkout@v4
- name: Download Upstream Corpus
run: curl -L -o /tmp/corpus-tests.tar.gz https://raw.githubusercontent.com/cedar-policy/cedar-integration-tests/main/corpus-tests.tar.gz
# cmp returns status code 1 if the files differ
- name: Compare
id: compare
run: cmp /tmp/corpus-tests.tar.gz corpus-tests.tar.gz
- name: Notify on Failure
if: failure() && steps.compare.outcome == 'failure'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Get a list of all open issues labeled with 'upstream-corpus-test'. The documentation for
// listForRepo states that it should only return open issues.
const issues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'upstream-corpus-test'
})
.then((issues) => {
console.log(`Found ${issues.length} open issues`)
// 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; see DEVELOPMENT.md for instructions on how to do so.',
assignees: ['jmccarthy', 'philhassey', 'patjakdev'],
labels: ['upstream-corpus-test']
})
}
});