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

Run script handlers with ACTIONS_* environment variables #3390

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

blampe
Copy link

@blampe blampe commented Jul 15, 2024

Refs #3046.

This runs script steps with ACTIONS_* environment variables in exactly the same way they are passed to Docker and Node steps.

By doing so, this reduces the need for steps like crazy-max/ghaction-github-runtime when programmatically consuming cache APIs (for example via tonistiigi/go-actions-cache).

Test workflow:

on:
  workflow_dispatch:

jobs:
  main:
    runs-on: self-hosted
    steps:
      - run: env | grep ACTION

Before this change:

2024-07-15T16:22:56.0537770Z Complete job name: main
2024-07-15T16:22:56.0976680Z ##[group]Run env | grep ACTION
2024-07-15T16:22:56.0977140Z �[36;1menv | grep ACTION�[0m
2024-07-15T16:22:56.1109490Z shell: /opt/homebrew/bin/bash -e {0}
2024-07-15T16:22:56.1110200Z ##[endgroup]
2024-07-15T16:22:56.1625900Z GITHUB_ACTION=__run
2024-07-15T16:22:56.1626460Z GITHUB_ACTIONS=true
2024-07-15T16:22:56.1626900Z GITHUB_ACTION_REPOSITORY=
2024-07-15T16:22:56.1627290Z GITHUB_ACTION_REF=
2024-07-15T16:22:56.1692500Z Cleaning up orphan processes

After this change:

2024-07-15T16:19:49.4702740Z Complete job name: main
2024-07-15T16:19:49.5223750Z ##[group]Run env | grep ACTION
2024-07-15T16:19:49.5224190Z �[36;1menv | grep ACTION�[0m
2024-07-15T16:19:49.5284960Z shell: /opt/homebrew/bin/bash -e {0}
2024-07-15T16:19:49.5285720Z ##[endgroup]
2024-07-15T16:19:49.5671290Z GITHUB_ACTION=__run
2024-07-15T16:19:49.5672240Z ACTIONS_CACHE_URL=https://acghubeus1.actions.githubusercontent.com/***/
2024-07-15T16:19:49.5672970Z GITHUB_ACTIONS=true
2024-07-15T16:19:49.5673720Z ACTIONS_RUNTIME_URL=https://pipelinesghubeus8.actions.githubusercontent.com/***/
2024-07-15T16:19:49.5674680Z ACTIONS_RESULTS_URL=https://results-receiver.actions.githubusercontent.com/
2024-07-15T16:19:49.5699210Z ACTIONS_RUNTIME_TOKEN=***
2024-07-15T16:19:49.5699910Z GITHUB_ACTION_REPOSITORY=
2024-07-15T16:19:49.5700310Z GITHUB_ACTION_REF=
2024-07-15T16:19:49.5765400Z Cleaning up orphan processes

@blampe blampe requested a review from a team as a code owner July 15, 2024 16:35
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