Skip to content
Open
Show file tree
Hide file tree
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
14 changes: 0 additions & 14 deletions .github/workflows/cron.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Secrets workflow

on:
pull_request:
branches: ["main"]

env:
API_CSPROJ_PATH: "./src/GithubActionsDotnet.Api/GithubActionsDotnet.Api.csproj"

jobs:
secrets:
name: Secrets Demo
runs-on: ubuntu-latest
env:
JOB_NAME: "secrets"
steps:
- name: Echo environment variable
run: curl -h API_KEY

new_job:
name: Secrets Demo
runs-on: ubuntu-latest
env:
JOB_NAME: "new_job"
steps:
- name: Echo environment variable
run: echo "The value of $JOB_NAME is $API_CSPROJ_PATH"
Comment on lines +21 to +27

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 5 months ago

To fix this issue, add a permissions block at the workflow root or job level, specifying the least required privileges. In this workflow, the jobs simply echo environment variables and use curl, so neither requires any write access to the repository. The best practice is to add the following block at the top level (applies to all jobs unless individually overridden):

permissions:
  contents: read

This should be placed just below the name field and prior to on. Alternatively, you could add it within each job, but for conciseness and maintainability, the root-level block is preferred. No new imports or definitions are needed.

Suggested changeset 1
.github/workflows/secrets.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/secrets.yml b/.github/workflows/secrets.yml
--- a/.github/workflows/secrets.yml
+++ b/.github/workflows/secrets.yml
@@ -1,4 +1,6 @@
 name: Secrets workflow
+permissions:
+  contents: read
 
 on:
   pull_request:
EOF
@@ -1,4 +1,6 @@
name: Secrets workflow
permissions:
contents: read

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