Skip to content

Conversation

@rkunjappan
Copy link
Collaborator

No description provided.

- name: Checkout
uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Pull Request' step
Uses Step
uses 'shivammathur/setup-php' with ref 'v2', not a pinned commit hash
Comment on lines +36 to +51
name: Unit tests
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [8.2, 8.3, 8.4]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Composer install
run: composer install
- name: Run tests
run: composer run-script code:test

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 17 days ago

To address the problem, you should add a permissions block at the root level of the workflow file (.github/workflows/pull_request.yml). The block should grant only the minimal access required for the jobs within this workflow. Looking at the workflow, both job sections (linting, tests) only interact with the source code, they do not push commits, create comments, or open/close PRs, so the only permission strictly required is contents: read. The permissions block must be inserted after the name and before on, or at least before the jobs key, as per GitHub Actions YAML structure recommendations.

No additional methods, imports, or changes are necessary apart from adding this permissions block.


Suggested changeset 1
.github/workflows/pull_request.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -1,4 +1,6 @@
 name: Pull Request
+permissions:
+  contents: read
 on:
   pull_request:
     branches:
EOF
@@ -1,4 +1,6 @@
name: Pull Request
permissions:
contents: read
on:
pull_request:
branches:
Copilot is powered by AI and may make mistakes. Always verify output.
@rkunjappan rkunjappan changed the title [WIP]Integrate unit tests with github actions [WIP] Run tests with github actions Oct 23, 2025
@rkunjappan rkunjappan requested a review from chx October 23, 2025 19:46
@chx
Copy link
Collaborator

chx commented Oct 24, 2025

https://www.purencool.digital/development/using-php-webserver-to-run-drupal note it misses a line break after cd drupal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants