0

I've 2 workflows with the names update_workflow.yml and build.yml. As the name states, update_workflow.yml fetches the changes from the upstream repo and rebase my changes on top of it everyday. While the buidl.yml builds the build depending on the changes made.

The thing here to note is that, update_workflow.yml calls the build.yml after the update:

update_fork:
    # Here, comes all the git commands that actually updates the repo
build_now:
    needs: update_fork
    uses: ./.github/workflows/build.yml
    secrets: inherit

I've used workflow_call: in the build.yml.

Everything is working fine, but the actual problem that arises is when the build.yml is called.
It builds the build for the previous version and not the latest that update_fork.yml updated a minute back.
What changes should I need to make to make sure that, the called workflow build.yml is actually building the build for the latest freshly fetched update?
And yes, manually running build.yml works fine.

One solution that I found is that to call workflow_dispatch by using cURL request that I'm not comfortable with.
Can I make slight changes to the existing repo without actually using cURL?

Edit1: I cannot follow this method either as the output given by update_fork.yml updates the entire repo with below given commands:

git checkout main
git rebase upstream/main || git diff
git push -f origin main
echo "Rebase successful!"

Edit2:
Yes, I've added reference as main on both the files.

Update_fork.yml:

...
    steps:
      - name: Checkout Forked Repo
        uses: actions/checkout@v3
        with:
          repository: repo/name
          ref: main
          fetch-depth: '0'
      - name: Next step
...

build.yml:

...
    steps:
      - uses: actions/checkout@v3
        with:
          repository: repo/name
          ref: main
          fetch-depth: '0'
...
theycallmepix
  • 474
  • 4
  • 13
  • Regarding "**the actual problem that arises is when the build.yml is called. It builds the build for the previous version and not the latest that update_fork.yml updated a minute back.**", the recently updated repo is not checked out by the the build job, right? – Azeem Mar 13 '23 at 06:55
  • I've used `actions/checkout@v3` in my `build.yml` as the first step – theycallmepix Mar 13 '23 at 08:49
  • Please add that step to your question. Verify the latest reference it's being fed to checkout. Isn't the latest one after rebasing by the previous job? – Azeem Mar 13 '23 at 09:32
  • You mean, using `ref: main` under checkout on the `build.yml` as well as `update_fork.yml`. Right? I've already done that 2 days back, waiting for upstream update to check. – theycallmepix Mar 14 '23 at 17:26

0 Answers0