Skip to content

remove global env variables and replaces them by step-based env variables - #180

Merged
Chrico merged 10 commits into
mainfrom
feature/remove-global-env
Apr 1, 2025
Merged

remove global env variables and replaces them by step-based env variables#180
Chrico merged 10 commits into
mainfrom
feature/remove-global-env

Conversation

@Chrico

@Chrico Chrico commented Feb 27, 2025

Copy link
Copy Markdown
Member

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Following changes have been done do several workflows:

NODE_AUTH_TOKEN

The secrets.NODE_AUTH_TOKEN was removed from global "env" and added to "Setup up node"-step as local "env"-variable

GITHUB_USER_SSH_KEY

Removed from global "env" and

  1. moved to actions/checkout@v4 and with.ssh-key directly.
  2. moved as local "env" variables to "Set up SSH"-step.

GITHUB_USER_SSH_PUBLIC_KEY

The public SSH Key was removed from global "env" and injected into "Delete signing key files"- and "Set up signin commits"-steps as local "env" variable.

GITHUB_USER_EMAIL and GITHUB_USER_NAME

Remove both secrets from global "env" and moved them into "Set up Git"-step as local "env" variables.

NODE_OPTIONS

are moved out of the global "env" into the specific step where it is needed.

COMPOSER_AUTH

are moved out of the global "env" into the specific step where it is needed for installing composer dependencies.

…bles if needed. Following changes have been done do several workflows:

## NODE_AUTH_TOKEN
The secrets.NODE_AUTH_TOKEN was removed from global "env" and added to "Setup up node"-step as local "env"-variable

## GITHUB_USER_SSH_KEY
Removed from global "env" and
1. moved to actions/checkout@v4 "with.ssh-key" directly.
2. moved as local "env" variables to "Set up SSH"-step.

## GITHUB_USER_SSH_PUBLIC_KEY
The public SSH Key was removed from global "env" and injected into "Delete signing key files"- and "Set up signin commits"-steps as local "env" variable.

# GITHUB_USER_EMAIL and GITHUB_USER_NAME
Remove both secrets from global "env" and moved them into "Set up Git"-step as local "env" variables.
@Chrico
Chrico requested a review from a team February 27, 2025 14:14
@Chrico Chrico linked an issue Feb 27, 2025 that may be closed by this pull request
1 task
@Chrico
Chrico requested review from dottxado and tyrann0us February 27, 2025 14:15
@Chrico Chrico self-assigned this Feb 27, 2025
@Chrico Chrico added this to the Gekommen, um zu bleiben milestone Feb 27, 2025
@Chrico

Chrico commented Feb 27, 2025

Copy link
Copy Markdown
Member Author

We might want to discuss if this is correct:

- name: Set up Git
    env:
      GITHUB_USER_EMAIL: ${{ secrets.GITHUB_USER_EMAIL }}
      GITHUB_USER_NAME: ${{ secrets.GITHUB_USER_NAME }}
    if: ${{ env.GITHUB_USER_EMAIL != '' && env.GITHUB_USER_NAME != '' }}
    run: |
      git config --global user.email "${{ env.GITHUB_USER_EMAIL }}"
      git config --global user.name "${{ env.GITHUB_USER_NAME }}"

both, the secrets.GITHUB_USER_EMAIL and secrets.GITHUB_USER_NAME are optional, but in theory you could also just set 1 of both. But this if:-statement requires both to be set at the same time. Is there any use case where we just want to have 1 set or are both always required to ensure that it works?

As alternative we could use something like:

- name: Set up Git
    run: |
      ${{ secrets.GITHUB_USER_EMAIL != '' }} && git config --global user.email "${{ secrets.GITHUB_USER_EMAIL }}"
      ${{ secrets.GITHUB_USER_NAME != '' }} && git config --global user.name "${{ secrets.GITHUB_USER_NAME }}"

and/or we could also print a message (or document down), that if you decide to "Set up Git" you need both in order to function.

@tyrann0us tyrann0us left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for working on this. I left a couple of comments.

Is there any use case where we just want to have 1 set or are both always required to ensure that it works?

I would keep this as-is.

Comment thread .github/workflows/automatic-release.yml
Comment thread .github/workflows/build-and-push-assets.yml Outdated
Comment thread .github/workflows/build-and-push-assets.yml Outdated
Comment thread .github/workflows/build-and-push-assets.yml
Comment thread .github/workflows/build-assets-compilation.yml Outdated
Comment thread .github/workflows/wp-scripts-lint.yml

@tyrann0us tyrann0us left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for incorporating the changes. I left a question and a request; this should be good to go once these are resolved. 😉

Comment thread .github/workflows/build-assets-compilation.yml
Comment thread .github/workflows/ddev-playwright.yml
@dottxado

dottxado commented Mar 31, 2025

Copy link
Copy Markdown
Contributor

I only have a minor comment: please update the PR description to include the NODE_OPTIONS moving 😄

@Chrico

Chrico commented Mar 31, 2025

Copy link
Copy Markdown
Member Author

I only have a minor comment: please update the PR description to include the NODE_OPTIONS moving 😄

done 😬 and also added COMPOSER_AUTH ;-)

@tyrann0us tyrann0us left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm still unsure how many times we have to declare the local COMPOSER_AUTH variable, but this doesn't prevent me from approving. Thank you for working on this! 💪🏽 LGTM.

@Chrico
Chrico merged commit 1c8495c into main Apr 1, 2025
@Chrico
Chrico deleted the feature/remove-global-env branch April 1, 2025 05:08
@tyrann0us tyrann0us mentioned this pull request Apr 1, 2025
3 tasks
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.

[Feature Request]: Review reusable-workflows and "env"-usage

3 participants