Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set permissions for jobs with GITHUB_TOKEN in job level env variable #2479

Closed
varunsh-coder opened this issue Sep 6, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@varunsh-coder
Copy link
Member

There is an error condition to not set permissions for jobs with GITHUB_TOKEN in step level env variable

const errorSecretInRunStepEnvVariable = "KnownIssue-2: Jobs with run steps that use token in environment variable are not supported"

But if env variable is set at job level, the code sets token permissions. These may be incorrect as the specific logic to determine the permissions is not known.

Here is a test workflow

name: Job level env
on:
  pull_request:
    branches: [main]

jobs:
  Lint:
    env:
      GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
    runs-on: ubuntu-latest
    steps:
      
      - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
      - name: some step that uses token
        run: |
          npm ci
@varunsh-coder
Copy link
Member Author

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants