|
| 1 | +name: Pixel Schema Validation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [develop] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + pixel-validation: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + token: ${{ secrets.GT_DAXMOBILE }} |
| 18 | + ref: ${{ github.head_ref || github.ref }} |
| 19 | + |
| 20 | + - name: Use Node.js 20 |
| 21 | + uses: actions/setup-node@v4 |
| 22 | + with: |
| 23 | + node-version: 20.x |
| 24 | + |
| 25 | + - uses: actions/cache@v4 |
| 26 | + with: |
| 27 | + path: ~/.npm |
| 28 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 29 | + restore-keys: | |
| 30 | + ${{ runner.os }}-node- |
| 31 | +
|
| 32 | + - name: Checkout internal-github-asana-utils repo |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + token: ${{ secrets.GT_DAXMOBILE }} |
| 36 | + path: internal-github-asana-utils |
| 37 | + repository: duckduckgo/internal-github-asana-utils |
| 38 | + |
| 39 | + - name: Install dependencies |
| 40 | + run: npm ci --verbose |
| 41 | + working-directory: PixelDefinitions |
| 42 | + |
| 43 | + # Lint step for push (fail on error), for PRs run fix instead |
| 44 | + - name: Check or Fix lint |
| 45 | + id: lint |
| 46 | + run: | |
| 47 | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then |
| 48 | + npm run lint.fix || true |
| 49 | + else |
| 50 | + npm run lint |
| 51 | + fi |
| 52 | + working-directory: PixelDefinitions |
| 53 | + |
| 54 | + # Commit and push changes if lint.fix was run and made changes |
| 55 | + - name: Commit and push linter fixes (PRs only) |
| 56 | + if: github.event_name == 'pull_request' |
| 57 | + run: | |
| 58 | + git config --global user.name "github-actions[bot]" |
| 59 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 60 | + git add PixelDefinitions/ |
| 61 | + if ! git diff --cached --quiet; then |
| 62 | + git commit -m "chore: auto-fix lint errors" |
| 63 | + git push |
| 64 | + fi |
| 65 | +
|
| 66 | + - name: Run pixel validation |
| 67 | + run: npm run validate-defs-without-formatting -- -g ../internal-github-asana-utils/user_map.yml |
| 68 | + working-directory: PixelDefinitions |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
0 commit comments