Merge pull request #286 from is-a-good-dev/WilliamDavidHarrison-patch-2

prettier
This commit is contained in:
Tweak
2022-11-28 21:43:22 -07:00
committed by GitHub
2 changed files with 12 additions and 9 deletions
+5 -6
View File
@@ -8,24 +8,24 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
- name: Get Files
id: changed-files
uses: tj-actions/changed-files@v34
with:
files: |
sub-logs/**
reserved/**
- name: Install modules
- name: Install Modules
if: steps.changed-files.outputs.any_changed == 'true'
run: yarn
- name: Run tests
- name: Run Tests
if: steps.changed-files.outputs.any_changed == 'true'
id: tests
run: yarn test
env:
FILES: ${{ steps.changed-files.outputs.all_changed_files }}
actions_path: ${{ github.workspace }}
- name: Comment Results
- name: Comment
if: steps.tests.outputs.shouldComment == 'true'
uses: mshick/add-pr-comment@v1
with:
@@ -42,5 +42,4 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
proxy-url: https://api.is-a-good.dev/github-proxy/
repo-token-user-login: 'github-actions[bot]' # The user.login for temporary GitHub tokens
allow-repeats: false # This is the default
allow-repeats: false # Default: false
+7 -3
View File
@@ -3,25 +3,29 @@ const getJSON = require('../utils/getJSON.js');
const checkInfo = require('../utils/checkInfo.js');
const checkRecords = require('../utils/checkRecords.js');
const data = getJSON(process.env.FILES);
if (data == false) {
core.setOutput('shouldComment', 'false')
console.log('Not a subdomain file')
process.exit(0)
}
core.setOutput('infoMessage', "Could not validate info.");
core.setOutput('recordMessage', "Could not validate records.");
core.setOutput('jsonData', data)
core.setOutput('shouldComment', 'true')
test('check if json file has required info', async () => {
const passed = await checkInfo(data);
let infoMessage = passed === true ? "Valid Info Provided." : passed === "unknown" ? "Error Verifying Email.\nA maintainer will have to manually verify your email.\nReason:" : "Invalid Info Provided.\nPlease check your provided info.\nReason:";
let infoMessage = passed === true ? "Valid information provided." : passed === "unknown" ? "Error verifying email address.\nA maintainer will have to manually verify your email address.\nReason:" : "Invalid information provided.\nPlease check your provided information.\nReason:";
core.setOutput('infoMessage', infoMessage);
expect(passed).toBeTruthy();
}, 15000);
test('check if json file follows format', () => {
test('Check if JSON file follows format', () => {
const passed = checkRecords(data);
let recordMessage = passed === true ? "Valid Records Provided." : "Invalid Records Provided.\nPlease check your provided records.\nThey should only be of type `CNAME` or `A` or `TXT`, and should follow their respective formats.";
let recordMessage = passed === true ? "Valid records provided." : "Invalid records provided.\nPlease check your provided records.\nThey should only be of type `A`, `CNAME` or `TXT`, and should follow their respective formats.";
core.setOutput('recordMessage', recordMessage);
expect(passed).toBe(true);
});