Skip to content

v3 regression: PermissionError writing to $GITHUB_OUTPUT as non-root user #598

@daniel-morris-01

Description

@daniel-morris-01

Describe the bug

Running github/issue-metrics@v3 now fails with: PermissionError: [Errno 13] Permission denied: '/github/file_commands/set_output_' The image switched to USER appuser in v3. The action code opens os.environ['GITHUB_OUTPUT'] directly in append mode. The file under /github/file_commands is owned by root and not writable by appuser, causing the failure. v2 (root) worked. Suggested fixes:

Replace direct Python file open with documented echo >> $GITHUB_OUTPUT pattern in a shell context; or
Adjust permissions / run as root; or
Create a wrapper entrypoint that safely appends outputs.
Let me know if you’d like that formatted as an actual issue payload.

To Reproduce

For me:
Just run the action:

  • name: Run issue-metrics tool
    uses: github/issue-metrics@v3
    env:
    GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    SEARCH_QUERY:

Expected behavior

run successfully as it has done up until two days ago

Screenshots

Time to close: 2 days, 3:26:19
Traceback (most recent call last):
File "/action/workspace/issue_metrics.py", line 414, in
main()
~~~~^^
File "/action/workspace/issue_metrics.py", line 375, in main
write_to_json(
~~~~~~~~~~~~~^
issues_with_metrics=issues_with_metrics,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<9 lines>...
output_file=output_file,
^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/action/workspace/json_writer.py", line 201, in write_to_json
with open(os.environ["GITHUB_OUTPUT"], "a") as file_handle:
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/github/file_commands/set_output_6112ba80-b848-42f1-9eba-00510a89af56'

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions