Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/pr-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: PR Checks

on:
pull_request:
types: [opened, edited, reopened, synchronize]

jobs:
deploy:
name: PR Jira validation check
runs-on: [ubuntu-latest]
steps:
Comment on lines +9 to +11

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add an explicit permissions: block for least-privilege GITHUB_TOKEN

The job currently inherits the default (contents: read, write to everything else), which is broader than needed for a read-only validation action. Add a minimal permissions stanza right under the jobs: level to satisfy CodeQL and harden the workflow.

   deploy:
     name: PR Jira validation check
+    permissions:
+      pull-requests: read
+      contents: read
+      issues: read
     runs-on: ubuntu-latest

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Check: CodeQL

[warning] 9-17: Workflow does not contain permissions
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: {{}}

🤖 Prompt for AI Agents
In .github/workflows/pr-check.yaml around lines 9 to 11, the workflow job lacks
an explicit permissions block, causing it to inherit overly broad default
permissions. Add a minimal permissions block at the jobs level specifying only
the necessary read permissions for the GITHUB_TOKEN, such as 'contents: read',
to enforce least privilege and satisfy CodeQL requirements.

- name: PR Jira validation check
uses: triplelift-internal/actions/pr-check@v1.0

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'PR Checks' step
Uses Step
uses 'triplelift-internal/actions/pr-check' with ref 'v1.0', not a pinned commit hash

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Pin the action ref to a commit SHA to mitigate supply-chain risk

Using the mutable tag v1.0 allows upstream changes to silently alter your CI behaviour. Pin the ref to the exact commit SHA (and optionally leave a comment with the tag for readability).

-         uses: triplelift-internal/actions/pr-check@v1.0
+         # v1.0 ⇒ 5b6c1d2 (example)
+         uses: triplelift-internal/actions/pr-check@5b6c1d2fe4a1e9e1b2c3d4e5f67890123456789
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: triplelift-internal/actions/pr-check@v1.0
# v1.0 ⇒ 5b6c1d2 (example)
uses: triplelift-internal/actions/pr-check@5b6c1d2fe4a1e9e1b2c3d4e5f67890123456789
🧰 Tools
🪛 GitHub Check: CodeQL

[warning] 13-13: Unpinned tag for a non-immutable Action in workflow
Unpinned 3rd party Action 'PR Checks' step Uses Step uses 'triplelift-internal/actions/pr-check' with ref 'v1.0', not a pinned commit hash

🤖 Prompt for AI Agents
In .github/workflows/pr-check.yaml at line 13, the action reference uses a
mutable tag 'v1.0' which can lead to unpredictable CI behavior due to upstream
changes. Replace the 'v1.0' tag with the exact commit SHA of the action to pin
the version securely. Optionally, add a comment next to the SHA indicating the
original tag for clarity.

with:
github_token: '${{ secrets.GH_ORG_TOKEN }}'
jira_user: '${{ secrets.JIRA_USER }}'
jira_token: '${{ secrets.JIRA_TOKEN }}'
Comment on lines +9 to +17

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: {}

Copilot Autofix

AI about 1 year ago

To fix this problem, add an explicit permissions key to either the root of the workflow or the specific job. The best practice is to grant only those permissions required for the job to function correctly. For a PR validation check, this typically means granting read access to repository contents (contents: read) and write access to pull-requests (pull-requests: write) if the action needs to leave comments, set PR status, etc. The recommended change is to add the following block to the root of the workflow file, right after the name: (line 1):

permissions:
  contents: read
  pull-requests: write

This will ensure all jobs inherit these restricted permissions unless overridden. No additional imports or definitions are required.


Suggested changeset 1
.github/workflows/pr-check.yaml

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/pr-check.yaml b/.github/workflows/pr-check.yaml
--- a/.github/workflows/pr-check.yaml
+++ b/.github/workflows/pr-check.yaml
@@ -1,3 +1,6 @@
+permissions:
+  contents: read
+  pull-requests: write
 name: PR Checks
 
 on:
EOF
@@ -1,3 +1,6 @@
permissions:
contents: read
pull-requests: write
name: PR Checks

on:
Copilot is powered by AI and may make mistakes. Always verify output.
Loading