actions / actions/runner

GitHub cannot handle the github context for pull_requests with html. `toJSON` fails.

Open
#1,435 5 comments 0 reactions 1 assignee View on GitHub

@nikola-jokic is already working on this.

Since Feb 17, 2022.

bug Runner Bug Stale
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

Describe the bug
When a Pull Request is created with HTML in it, f.e. a Dependabot PR, the github event can not be parsed. The toJson method is not escaping the HTML parts correctly.

To Reproduce
Steps to reproduce the behavior:

  1. Pass the github context to an action, with the toJSON function. Screenshot 2021-10-26 at 16 27 12
  2. Try parsing the github context when passed as in a Pull_request workflow with jq. Screenshot 2021-10-26 at 16 28 10

I've created a repository with this setup. See PR.

  1. Go to https://github.com/JeroenKnoops/test-github-pull-request-event/pull/3
  2. Two workflows run, one on commit, and one on Pull Request. The commit is correct, the Pull Request fails because of the html in the request.
  3. Look at the error-log of the Pull Request: In line 735 you will see the double \ in the html part of the body of the PR. This can not be decoded by jq, that's why the workflow fails.
Screenshot 2021-10-26 at 16 23 39

Expected behavior
The toJSON function should encode the HTML content of the PR body correctly.

Runner Version and Platform

Using the GitHub cloud runners.

What's not working?

parse error: Invalid escape at line 1, column 9651

See screenshot in step 3.

This has impact on ALL dependabot PRs made which triggering a pull_request event. You cannot use the github context in those cases.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.