Skip to content
Merged
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
18 changes: 16 additions & 2 deletions .github/workflows/style-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on: [push, pull_request_target]
jobs:
eslint_check_upload:
runs-on: ubuntu-latest
permissions:
contents: read
name: ESLint Check and Report Upload

steps:
Expand All @@ -19,6 +21,8 @@ jobs:
cache: 'yarn'
- name: Install Dependencies
run: yarn install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: true
- name: Build Packages
run: NODE_OPTIONS='--max-old-space-size=4096' yarn build:all
- name: Eslint Check
Expand All @@ -36,6 +40,8 @@ jobs:
annotation:
# Skip the annotation action in push events
if: github.event_name == 'pull_request_target'
permissions:
checks: write
needs: eslint_check_upload
runs-on: ubuntu-latest
name: ESLint Annotation
Expand All @@ -44,14 +50,16 @@ jobs:
with:
name: eslint_report.json
- name: Annotate Code Linting Results
uses: ataylorme/eslint-annotate-action@d57a1193d4c59cbfbf3f86c271f42612f9dbd9e9
uses: ataylorme/eslint-annotate-action@5f4dc2e3af8d3c21b727edb597e5503510b1dc9c
with:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
repo-token: '${{ secrets.GITHUB_TOKEN }}'
report-json: 'eslint_report.json'
Copy link

Choose a reason for hiding this comment

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

Bug: The ataylorme/eslint-annotate-action is passed an incorrect repo-token parameter. The action expects GITHUB_TOKEN, which will cause authentication to fail.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

The ataylorme/eslint-annotate-action is configured to receive an authentication token via the repo-token parameter. However, an analysis of the action's definition, for both the previous and updated versions, confirms that it expects this token to be passed using the GITHUB_TOKEN parameter. Because the wrong parameter name is used, the action will not receive the necessary authentication token. This will cause the step to fail, preventing ESLint annotations from being posted to pull requests.

💡 Suggested Fix

In the .github/workflows/style-check.yml file, change the parameter name from repo-token back to GITHUB_TOKEN for the ataylorme/eslint-annotate-action step to ensure the authentication token is passed correctly.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/style-check.yml#L56

Potential issue: The `ataylorme/eslint-annotate-action` is configured to receive an
authentication token via the `repo-token` parameter. However, an analysis of the
action's definition, for both the previous and updated versions, confirms that it
expects this token to be passed using the `GITHUB_TOKEN` parameter. Because the wrong
parameter name is used, the action will not receive the necessary authentication token.
This will cause the step to fail, preventing ESLint annotations from being posted to
pull requests.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7729258

Copy link
Author

Choose a reason for hiding this comment

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


prettier_check:
# In the forked PR, it's hard to format code and push to the branch directly, so the action only check the format correctness.
if: github.event_name != 'push' && github.event.pull_request.head.repo.full_name != 'rrweb-io/rrweb'
permissions:
contents: read
runs-on: ubuntu-latest
name: Format Check
steps:
Expand All @@ -66,13 +74,17 @@ jobs:
cache: 'yarn'
- name: Install Dependencies
run: yarn install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: true
- name: Prettier Check
run: yarn prettier --check '**/*.{ts,md}'

prettier:
# Skip the format code action in forked PRs
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'rrweb-io/rrweb'
runs-on: ubuntu-latest
permissions:
contents: write
name: Format Code
steps:
- uses: actions/checkout@v3
Expand All @@ -86,6 +98,8 @@ jobs:
cache: 'yarn'
- name: Install Dependencies
run: yarn install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: true
- name: Prettify Code
run: yarn prettier --write '**/*.{ts,md}'
- name: Commit Changes
Expand Down
Loading