mirror of
https://github.com/tiennm99/open-domains.git
synced 2026-10-12 12:14:12 +00:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
163 lines
5.2 KiB
YAML
163 lines
5.2 KiB
YAML
name: Validation
|
|
|
|
on:
|
|
pull_request_target:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "domains/*"
|
|
- "tests/*"
|
|
- "utils/*"
|
|
- ".github/workflows/validation.yml"
|
|
- "dnsconfig.js"
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: pr-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
dns:
|
|
name: DNS
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Log Git State
|
|
run: |
|
|
echo "GITHUB_REF: $GITHUB_REF"
|
|
echo "GITHUB_SHA: $GITHUB_SHA"
|
|
echo "PR HEAD SHA: ${{ github.event.pull_request.head.sha }}"
|
|
git rev-parse --abbrev-ref HEAD
|
|
git log -1 --oneline
|
|
|
|
- id: create_token
|
|
uses: tibdex/github-app-token@v2
|
|
with:
|
|
app_id: ${{ secrets.APP_ID }}
|
|
private_key: ${{ secrets.PRIVATE_KEY }}
|
|
|
|
- name: Check DNS
|
|
id: dns_check
|
|
uses: is-a-dev/dnscontrol-action@main
|
|
with:
|
|
args: check
|
|
config_file: "dnsconfig.js"
|
|
|
|
- name: Add Validated DNS Label
|
|
if: ${{ github.event_name == 'pull_request' && steps.dns_check.outcome == 'success' }}
|
|
uses: actions-ecosystem/action-add-labels@v1
|
|
with:
|
|
labels: "Validated DNS"
|
|
github_token: ${{ steps.create_token.outputs.token }}
|
|
issue_number: ${{ github.event.pull_request.number }}
|
|
|
|
- name: Remove Invalid DNS Label
|
|
if: ${{ github.event_name == 'pull_request' && steps.dns_check.outcome == 'success' }}
|
|
uses: actions-ecosystem/action-remove-labels@v1
|
|
with:
|
|
labels: "Invalid DNS"
|
|
github_token: ${{ steps.create_token.outputs.token }}
|
|
issue_number: ${{ github.event.pull_request.number }}
|
|
|
|
- name: Add Invalid DNS Label
|
|
if: ${{ github.event_name == 'pull_request' && failure() }}
|
|
uses: actions-ecosystem/action-add-labels@v1
|
|
with:
|
|
labels: "Invalid DNS"
|
|
github_token: ${{ steps.create_token.outputs.token }}
|
|
issue_number: ${{ github.event.pull_request.number }}
|
|
|
|
- name: Remove Validated DNS Label
|
|
if: ${{ github.event_name == 'pull_request' && failure() }}
|
|
uses: actions-ecosystem/action-remove-labels@v1
|
|
with:
|
|
labels: "Validated DNS"
|
|
github_token: ${{ steps.create_token.outputs.token }}
|
|
issue_number: ${{ github.event.pull_request.number }}
|
|
|
|
json:
|
|
name: JSON
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Log Git State
|
|
run: |
|
|
echo "GITHUB_REF: $GITHUB_REF"
|
|
echo "GITHUB_SHA: $GITHUB_SHA"
|
|
echo "PR HEAD SHA: ${{ github.event.pull_request.head.sha }}"
|
|
git rev-parse --abbrev-ref HEAD
|
|
git log -1 --oneline
|
|
|
|
- id: create_token
|
|
uses: tibdex/github-app-token@v2
|
|
with:
|
|
app_id: ${{ secrets.APP_ID }}
|
|
private_key: ${{ secrets.PRIVATE_KEY }}
|
|
|
|
- name: JSON Syntax Check
|
|
id: json_check
|
|
uses: limitusus/json-syntax-check@v2
|
|
with:
|
|
pattern: "\\.json$"
|
|
env:
|
|
BASE: "domains/"
|
|
|
|
- name: Add Validated JSON Label
|
|
if: ${{ github.event_name == 'pull_request' && steps.json_check.outcome == 'success' }}
|
|
uses: actions-ecosystem/action-add-labels@v1
|
|
with:
|
|
labels: "Validated JSON"
|
|
github_token: ${{ steps.create_token.outputs.token }}
|
|
issue_number: ${{ github.event.pull_request.number }}
|
|
|
|
- name: Remove Invalid JSON Label
|
|
if: ${{ github.event_name == 'pull_request' && steps.json_check.outcome == 'success' }}
|
|
uses: actions-ecosystem/action-remove-labels@v1
|
|
with:
|
|
labels: "Invalid JSON"
|
|
github_token: ${{ steps.create_token.outputs.token }}
|
|
issue_number: ${{ github.event.pull_request.number }}
|
|
|
|
- name: Add Invalid JSON Label
|
|
if: ${{ github.event_name == 'pull_request' && failure() }}
|
|
uses: actions-ecosystem/action-add-labels@v1
|
|
with:
|
|
labels: "Invalid JSON"
|
|
github_token: ${{ steps.create_token.outputs.token }}
|
|
issue_number: ${{ github.event.pull_request.number }}
|
|
|
|
- name: Remove Validated JSON Label
|
|
if: ${{ github.event_name == 'pull_request' && failure() }}
|
|
uses: actions-ecosystem/action-remove-labels@v1
|
|
with:
|
|
labels: "Validated JSON"
|
|
github_token: ${{ steps.create_token.outputs.token }}
|
|
issue_number: ${{ github.event.pull_request.number }}
|
|
|
|
tests:
|
|
name: Tests
|
|
if: "!contains(github.event.head_commit.message, '[skip-ci]')"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Log Git State
|
|
run: |
|
|
echo "GITHUB_REF: $GITHUB_REF"
|
|
echo "GITHUB_SHA: $GITHUB_SHA"
|
|
echo "PR HEAD SHA: ${{ github.event.pull_request.head.sha }}"
|
|
git rev-parse --abbrev-ref HEAD
|
|
git log -1 --oneline
|
|
|
|
- run: npm install
|
|
|
|
- run: npm test
|