Replace Mendeley Desktop with Reference Manager #64
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate | |
| defaults: | |
| run: | |
| shell: bash | |
| on: | |
| push: | |
| paths: | |
| - 'Apps/**' | |
| - 'Manifests/**' | |
| branches-ignore: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'Apps/**' | |
| - 'Manifests/**' | |
| workflow_dispatch: | |
| jobs: | |
| psscriptanalyzer: | |
| runs-on: ubuntu-latest | |
| name: 'Run PSScriptAnalyzer' | |
| permissions: | |
| contents: read # for actions/checkout to fetch code | |
| security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
| actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: 'Analyse PowerShell' | |
| uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f | |
| with: | |
| path: "./Apps" | |
| recurse: true | |
| settings: ".rules/PSScriptAnalyzerSettings.psd1" | |
| output: results.sarif | |
| # Upload the SARIF file generated in the previous step | |
| - name: 'Upload SARIF results file' | |
| uses: github/codeql-action/upload-sarif@v3 | |
| with: | |
| sarif_file: results.sarif | |
| validate-json: | |
| runs-on: ubuntu-latest | |
| name: 'Validate apps and manifests' | |
| needs: psscriptanalyzer | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: 'Checkout repository' | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: main | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: 'Validate file types' | |
| run: | | |
| # Check Apps directory contains only .ps1 files | |
| if find Apps -type f ! -name '*.ps1' | grep -q .; then | |
| echo "Error: Apps directory contains non-.ps1 files:" | |
| find Apps -type f ! -name '*.ps1' | |
| exit 1 | |
| fi | |
| # Check Manifests directory contains only .json files | |
| if find Manifests -type f ! -name '*.json' | grep -q .; then | |
| echo "Error: Manifests directory contains non-.json files:" | |
| find Manifests -type f ! -name '*.json' | |
| exit 1 | |
| fi | |
| - name: 'Check for empty files' | |
| run: | | |
| find Apps Manifests -type f -empty > empty_files.txt | |
| if [ -s empty_files.txt ]; then | |
| echo "Empty files found:" | |
| cat empty_files.txt | |
| exit 1 | |
| fi | |
| - name: 'Validate JSON files' | |
| run: | | |
| find Manifests -type f -name '*.json' | while read -r file; do | |
| if ! jq empty "$file"; then | |
| echo "Invalid JSON: $file" | |
| exit 1 | |
| fi | |
| done | |
| - name: 'Validate UTF-8 encoding for PowerShell files' | |
| run: | | |
| find Apps -type f -name '*.ps1' | while read -r file; do | |
| if ! file -b --mime-encoding "$file" | grep -qE '^(utf-8|us-ascii)$'; then | |
| echo "Not UTF-8 encoded: $file ($(file -b --mime-encoding "$file"))" | |
| exit 1 | |
| fi | |
| done | |
| - name: 'Validate UTF-8 encoding for JSON files' | |
| run: | | |
| find Manifests -type f -name '*.json' | while read -r file; do | |
| if ! file -b --mime-encoding "$file" | grep -qE '^(utf-8|us-ascii)$'; then | |
| echo "Not UTF-8 encoded: $file ($(file -b --mime-encoding "$file"))" | |
| exit 1 | |
| fi | |
| done |