nrwl / nx-set-shas

:sparkles: A Github Action which sets the base and head SHAs required for `nx affected` commands in CI
https://nx.dev
MIT License
161 stars 76 forks source link

Workflow ID detection is broken in v4.1.2 #174

Open korniychuk opened 6 days ago

korniychuk commented 6 days ago

Hi dear NX team 👐

In the newest release (v4.1.2), the nx-set-shas action started to fail due to an error fetching workflow_id via the GH API.

Step configuration to reproduce

      - name: Derive appropriate SHAs for base and head for `nx affected` commands
        uses: nrwl/nx-set-shas@v4
        with:
          main-branch-name: ${{ github.base_ref }}
          last-successful-event: schedule # for 'master' workflow (only 1 can be specified. workflow_dispatch - skipped)

Error screenshots

Image Image


Thanks! 🙏

korniychuk commented 6 days ago

UPDATE: We have NodeJS version v18.10.0 (we're going to upgrade soon); maybe it'll work on v20.

(I've just read your disclaimer)

NOTE: The v4 does no longer support deprecated Node versions. The supported version is Node v18+.

rafaellucio commented 1 day ago

I have de same problem, and I pass workflow-id in environment and not works too

Download action repository 'nrwl/nx-set-shas@v4' (SHA:e2e6dc8bce4b0387a05eb687735c39c41580b792)
Download action repository 'gang-of-front/action-nx-affected-list@main' (SHA:a5f7a1b25c7977f8a7[4](https://github.com/Creditas/benefits-lead-form/actions/runs/11802818118/job/32879336627#step:4:4)7a683265861d0cdb295e7)
Run ./.github/actions/affected
  with:
  env:
    PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    NODE_AUTH_TOKEN: ***
Run nrwl/nx-set-shas@v4
Run node "$GITHUB_ACTION_PATH/dist/index.js" "$gh_token" "$main_branch_name" "$error_on_no_successful_workflow" "$last_successful_event" "$working_directory" "$working_id" "$fallback_sha"
  node "$GITHUB_ACTION_PATH/dist/index.js" "$gh_token" "$main_branch_name" "$error_on_no_successful_workflow" "$last_successful_event" "$working_directory" "$working_id" "$fallback_sha"
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    NODE_AUTH_TOKEN: ***
    gh_token: ***
    main_branch_name: master
    error_on_no_successful_workflow: false
    last_successful_event: pull_request
    working_directory: .
    working_id: 
    fallback_sha: 

Workflow Id not provided. Using workflow 'undefined'
Error: Process completed with exit code 1.
runs:
  using: "composite"
  steps:
    - name: Derive appropriate SHAs for base and head for `nx affected` commands
      id: setSHAs
      uses: nrwl/nx-set-shas@v4
      with:
        main-branch-name: "master"
        last-successful-event: "pull_request"
        workflow-id: ${{ github.run_id }}

Image