Skip to content

Show Norway tags in post group tags widget #55

Show Norway tags in post group tags widget

Show Norway tags in post group tags widget #55

Workflow file for this run

name: PHP Code Analysis
on:
workflow_dispatch:
push:
branches: [ "master" ]
paths:
- "plugins/**"
pull_request:
branches: [ "master" ]
paths:
- "plugins/**"
permissions:
contents: read
security-events: write # Required to upload SARIF files
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
# This config file gets auto-loaded by Psalm
# !!!! The old bcc-signon plugin and the bcc-wp-proxy plugin are excluded from analysis!
- name: Set Psalm config
run: |
cat <<'EOF' > psalm.xml
<?xml version="1.0"?>
<!-- Psalm has levels of strictness (errorLevel) from 1 (most strict) to 8 (most lenient). -->
<psalm
xmlns="https://getpsalm.org/schema/config"
errorLevel="2"
>
<projectFiles>
<directory name="plugins" />
<ignoreFiles>
<directory name="plugins/bcc-signon" />
<directory name="plugins/bcc-wp-proxy" />
</ignoreFiles>
</projectFiles>
<stubs>
<file name="custom-defs.stub" />
</stubs>
<plugins>
<pluginClass class="PsalmWordPress\Plugin">
<requireAllParams value="true" />
</pluginClass>
</plugins>
</psalm>
EOF
- name: Create stubs for dependency functions (e.g. other plugin funcions). If this grows too big it can be commited as a separate file
run: |
cat <<'EOF' > custom-defs.stub
<?php
/**
* @param mixed $post_id
* @return mixed|null
*/
function get_field(
string $selector,
$post_id = false,
bool $format_value = true,
bool $escape_html = false
) {};
/**
* @return string
*/
function get_culture() {};
EOF
- name: Install Psalm and Wordpress stubs
run: |
composer require --dev php-stubs/wordpress-stubs ~6.8.0
composer require --dev humanmade/psalm-plugin-wordpress
- name: Run Psalm
uses: psalm/psalm-github-actions@26f175f4d1d9006ea675bb78831ae94126017b07
with:
security_analysis: true
composer_require_dev: true
report_file: results.sarif
- name: Upload Security Analysis results to GitHub
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: results.sarif