|
49 | 49 | hosters: '[{"name": "Hoster Test One", "url": "https://example.com/hoster1"}, {"name": "Hoster Test Two", "url": "https://example.com/hoster2"}]' |
50 | 50 | speakers: '[{"name": "Speaker One", "url": "https://example.com/speaker1"}, {"name": "Speaker Two", "url": "https://example.com/speaker2"}]' |
51 | 51 | should-fix: false |
| 52 | + google-credentials: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_CREDENTIALS }} |
| 53 | + google-parent-folder-id: ${{ vars.GOOGLE_DRIVE_MEETUP_FOLDER_ID }} |
| 54 | + google-template-folder-id: ${{ vars.GOOGLE_DRIVE_MEETUP_TEMPLATE_FOLDER_ID }} |
52 | 55 | github-token: ${{ secrets.GITHUB_TOKEN }} |
53 | 56 |
|
| 57 | + - name: Assert valid meetup issue output |
| 58 | + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
| 59 | + env: |
| 60 | + VALID_MEETUP_ISSUE: ${{ steps.act.outputs.valid-meetup-issue }} |
| 61 | + with: |
| 62 | + script: | |
| 63 | + const assert = require("node:assert/strict"); |
| 64 | + const raw = process.env.VALID_MEETUP_ISSUE; |
| 65 | +
|
| 66 | + assert.ok(raw, "valid-meetup-issue output is empty"); |
| 67 | +
|
| 68 | + let parsed; |
| 69 | + try { |
| 70 | + parsed = JSON.parse(raw); |
| 71 | + } catch (error) { |
| 72 | + throw new Error(`valid-meetup-issue is not valid JSON: ${error}`); |
| 73 | + } |
| 74 | + const expectedValidMeetupIssue = { |
| 75 | + number: Number(process.env.TEST_VALID_ISSUE_NUMBER), |
| 76 | + title: "", |
| 77 | + labels: [], |
| 78 | + hoster: { |
| 79 | + name: "Hoster Test One", |
| 80 | + url: "https://example.com/hoster1", |
| 81 | + }, |
| 82 | + speakers: [ |
| 83 | + { |
| 84 | + name: "Speaker One", |
| 85 | + url: "https://example.com/speaker1", |
| 86 | + }, |
| 87 | + { |
| 88 | + name: "Speaker Two", |
| 89 | + url: "https://example.com/speaker2", |
| 90 | + }, |
| 91 | + ], |
| 92 | + "parsed-body": { |
| 93 | + |
| 94 | + }, |
| 95 | + "drive-files": { |
| 96 | + }, |
| 97 | + }; |
| 98 | +
|
| 99 | + assert.deepEqual( |
| 100 | + parsed, |
| 101 | + expectedValidMeetupIssue, |
| 102 | + "valid-meetup-issue payload mismatch" |
| 103 | + ); |
| 104 | +
|
54 | 105 | - name: Assert |
55 | 106 | run: | |
56 | 107 | if [[ "${{ steps.act.outputs.lint-issues }}" != "" ]]; then |
@@ -98,29 +149,54 @@ jobs: |
98 | 149 | speakers: '[{"name": "Speaker One", "url": "https://example.com/speaker1"}, {"name": "Speaker Two", "url": "https://example.com/speaker2"}]' |
99 | 150 | should-fix: false |
100 | 151 | fail-on-error: false |
| 152 | + google-credentials: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_CREDENTIALS }} |
| 153 | + google-parent-folder-id: ${{ vars.GOOGLE_DRIVE_MEETUP_FOLDER_ID }} |
| 154 | + google-template-folder-id: ${{ vars.GOOGLE_DRIVE_MEETUP_TEMPLATE_FOLDER_ID }} |
101 | 155 | github-token: ${{ secrets.GITHUB_TOKEN }} |
102 | 156 |
|
103 | 157 | - name: Assert |
104 | | - run: | |
105 | | - LINT_ISSUES=$(cat <<EOF |
106 | | - ${{ steps.act.outputs.lint-issues }} |
107 | | - EOF |
108 | | - ) |
109 | | -
|
110 | | - EXPECTED_LINT_ISSUES=$(cat <<EOF |
111 | | - Title: Invalid, expected "[Meetup] - 2025-01-01 - Test Invalid Issue" |
112 | | - Hoster: "Wrong Hoster" is not an existing hoster |
113 | | - Event Description: Invalid input: expected string, received undefined |
114 | | - Agenda: Speaker "Wrong Speaker" is not in the list of speakers |
115 | | - Agenda: Entry "- Wrong agenda entry" must follow the format: "- <speaker(s)>: <talk_description>" |
116 | | - Meetup Link: Must be a valid Meetup link, e.g. https://www.meetup.com/cloud-native-aix-marseille/events/123456789 |
117 | | - CNCF Link: Must be a valid CNCF link, e.g. https://community.cncf.io/events/details/cncf-cloud-native-aix-marseille-presents-test-meetup-event |
118 | | - Drive Link: Must be a valid Drive Link, e.g. https://drive.google.com/drive/folders/1a2b3c4d5e6f7g8h9i0j |
119 | | - Labels: Missing label(s) "hoster:confirmed" |
120 | | - EOF |
121 | | - ) |
122 | | -
|
123 | | - if ! diff --color <(echo "${LINT_ISSUES}") <(echo "${EXPECTED_LINT_ISSUES}"); then |
124 | | - echo -e "The action did not return the expected list of issues" |
125 | | - exit 1 |
126 | | - fi |
| 158 | + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
| 159 | + env: |
| 160 | + LINT_ISSUES: ${{ steps.act.outputs.lint-issues }} |
| 161 | + with: |
| 162 | + script: | |
| 163 | + const assert = require("node:assert/strict"); |
| 164 | + const lintIssues = process.env.LINT_ISSUES ?? ""; |
| 165 | +
|
| 166 | + const expected = [ |
| 167 | + 'Title: Invalid, expected "[Meetup] - 2025-01-01 - Test Invalid Issue"', |
| 168 | + 'Hoster: "Wrong Hoster" is not an existing hoster', |
| 169 | + 'Event Description: Invalid input: expected string, received undefined', |
| 170 | + 'Agenda: Speaker "Wrong Speaker" is not in the list of speakers', |
| 171 | + 'Agenda: Entry "- Wrong agenda entry" must follow the format: "- <speaker(s)>: <talk_description>"', |
| 172 | + 'Meetup Link: Must be a valid Meetup link, e.g. https://www.meetup.com/cloud-native-aix-marseille/events/123456789', |
| 173 | + 'CNCF Link: Must be a valid CNCF link, e.g. https://community.cncf.io/events/details/cncf-cloud-native-aix-marseille-presents-test-meetup-event', |
| 174 | + 'Drive Link: Must be a valid Drive Link, e.g. https://drive.google.com/drive/folders/1a2b3c4d5e6f7g8h9i0j', |
| 175 | + 'Labels: Missing label(s) "hoster:confirmed"', |
| 176 | + ].join("\n"); |
| 177 | +
|
| 178 | + assert.ok(lintIssues, "lint-issues output is empty"); |
| 179 | + assert.equal( |
| 180 | + lintIssues.trim(), |
| 181 | + expected, |
| 182 | + [ |
| 183 | + "The action did not return the expected list of issues", |
| 184 | + "--- expected ---", |
| 185 | + expected, |
| 186 | + "--- received ---", |
| 187 | + lintIssues, |
| 188 | + ].join("\n") |
| 189 | + ); |
| 190 | +
|
| 191 | + - name: Assert valid meetup issue output is empty |
| 192 | + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
| 193 | + env: |
| 194 | + VALID_MEETUP_ISSUE: ${{ steps.act.outputs.valid-meetup-issue }} |
| 195 | + with: |
| 196 | + script: | |
| 197 | + const assert = require("node:assert/strict"); |
| 198 | + assert.equal( |
| 199 | + process.env.VALID_MEETUP_ISSUE ?? "", |
| 200 | + "", |
| 201 | + "valid-meetup-issue output should be empty when lint issues are returned" |
| 202 | + ); |
0 commit comments