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

[BUG] Keep the same commit SHA between workflows #543

Closed
3 tasks done
rlinstorres opened this issue Jul 5, 2022 · 4 comments · Fixed by #549
Closed
3 tasks done

[BUG] Keep the same commit SHA between workflows #543

rlinstorres opened this issue Jul 5, 2022 · 4 comments · Fixed by #549
Labels
bug Something isn't working

Comments

@rlinstorres
Copy link

rlinstorres commented Jul 5, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Does this issue exist in the latest version?

  • I'm using the latest release

Describe the bug?

Hi, first of all, I am not sure if it is a bug or an improvement.

I have a workflow triggered by push events and the result of this workflow is triggering another workflow by workflow_run. The problem is in my second workflow when triggered the base_sha value is not keeping the same value as the first workflow.

Note: It's happening when I have more than one PR merged into the master branch sequentially.

First workflow:

jobs:
  job:
    name: Job
    runs-on: self-hosted-runner
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Modified Files
        uses: tj-actions/changed-files@v23.1
        with:
          files: .github/workflows/test.txt

Second workflow:

jobs:
  condition:
    if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
    name: Job Condition
    runs-on: self-hosted-runner
    steps:
      - uses: actions/checkout@v3
        name: github_event_workflow_run_head_sha
        with:
          fetch-depth: 0
          ref: ${{ github.event.workflow_run.head_sha }}

      - name: Modified Files
        uses: tj-actions/changed-files@v23.1
        with:
          files: .github/workflows/test.txt
          sha: ${{ github.event.workflow_run.head_sha }}

To Reproduce

For example:

First PR merged and first workflow:
Commit SHA: 4304a00cd43101d81d49b9ce277459267c446a5d
Base commit SHA: 8668dbc37408aafb315621ee66bdb154bfafc1ce

Screen Shot 2022-07-05 at 5 11 10 PM

Second workflow triggered from the first workflow:

Commit SHA: 4304a00cd43101d81d49b9ce277459267c446a5d
Base commit SHA: 4304a00cd43101d81d49b9ce277459267c446a5d

Screen Shot 2022-07-05 at 5 13 20 PM

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-20.04

Expected behavior?

I would like to keep the same base_sha value when working with workflow_run as a trigger.

Relevant log output

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@rlinstorres rlinstorres added the bug Something isn't working label Jul 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2022

Thanks for reporting this issue, don't forget to star this project to help us reach a wider audience.

@jackton1
Copy link
Member

jackton1 commented Jul 6, 2022

@rlinstorres Can you also include the event that triggers the workflow in your description.

Example

on:
   ...

jobs:
  job:
    name: Job
    runs-on: self-hosted-runner
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Modified Files
        uses: tj-actions/changed-files@v23.1
        with:
          files: .github/workflows/test.txt

@rlinstorres
Copy link
Author

rlinstorres commented Jul 6, 2022

@rlinstorres Can you also include the event that triggers the workflow in your description.

Example

on:
   ...

jobs:
  job:
    name: Job
    runs-on: self-hosted-runner
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Modified Files
        uses: tj-actions/changed-files@v23.1
        with:
          files: .github/workflows/test.txt

Hi @jackton1, for sure, sorry!

  • First workflow:
on:
  push:
    branches:
      - master
  workflow_dispatch:
  • Second workflow:
on:
  workflow_run:
    workflows: [first-workflow]
    types: [completed]
    branches:
      - master
  workflow_dispatch:

@jackton1 jackton1 linked a pull request Jul 19, 2022 that will close this issue
@jackton1
Copy link
Member

@rlinstorres This should be resolved in the latest release v23.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants