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

Dump resources, especially checks, for debugging #832

Merged
merged 28 commits into from
Jun 5, 2024

Conversation

kachick
Copy link
Owner

@kachick kachick commented Jun 3, 2024

No description provided.

.github/workflows/itself.yml Outdated Show resolved Hide resolved
src/main.ts Outdated
interface Dumper {
trigger: Trigger;
options: Options;
payload: WebhookPayload;
Copy link
Owner Author

Choose a reason for hiding this comment

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

I want a payload for addressing issues, such as #767.
However, the object schema scares me due to accidents. 🤔

Copy link
Owner Author

Choose a reason for hiding this comment

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

[github context](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context)
The github context contains information about the workflow run and the event that triggered the run. You can also read most of the github context data in environment variables. For more information about environment variables, see "[Variables](https://docs.github.com/en/actions/learn-github-actions/variables)."

Warning: When using the whole github context, be mindful that it includes sensitive information such as github.token. GitHub masks secrets when they are printed to the console, but you should be cautious when exporting or printing the context.

Warning: When creating workflows and actions, you should always consider whether your code might execute untrusted input from possible attackers. Certain contexts should be treated as untrusted input, as an attacker could insert their own malicious content. For more information, see "[Security hardening for GitHub Actions](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections)."

https://docs.github.com/en/actions/learn-github-actions/contexts#github-context

In my understanding, this payload will points to github.event, not the whole of context.

The full event webhook payload. You can access individual properties of the event using this context. This object is identical to the webhook payload of the event that triggered the workflow run, and is different for each event. The webhooks for each GitHub Actions event is linked in "Events that trigger workflows." For example, for a workflow run triggered by the push event, this object contains the contents of the push webhook payload.

But...

@kachick
Copy link
Owner Author

kachick commented Jun 5, 2024

https://docs.github.com/ja/actions/creating-actions/metadata-syntax-for-github-actions#outputs-for-docker-container-and-javascript-actions

Outputs are Unicode strings, and can be a maximum of 1 MB. The total of all outputs in a workflow run can be a maximum of 50 MB.

🙄

@kachick
Copy link
Owner Author

kachick commented Jun 5, 2024

So I should use @actions/artifact and adding new option to realize this https://github.com/actions/toolkit/blob/d1df13e178816d69d96bdc5c753b36a66ad03728/packages/artifact/README.md

@kachick
Copy link
Owner Author

kachick commented Jun 5, 2024

  • Create the file and just output the path
  • Do not use artifact directly in this action

@kachick kachick changed the title Prefer GITHUB_OUTPUT for printing debug resources Dump resources, especially checks, for debugging Jun 5, 2024
@kachick kachick marked this pull request as ready for review June 5, 2024 05:52
@kachick kachick merged commit 491543b into main Jun 5, 2024
33 checks passed
@kachick kachick deleted the prefer-output-rather-than-console-in-debug-mode branch June 5, 2024 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant