action-create-tag icon indicating copy to clipboard operation
action-create-tag copied to clipboard

Action tries to set tag for deleted repo when used in reusable workflow

Open bakoontz2 opened this issue 8 months ago • 0 comments

Describe the bug If an action is called as part of a reusable workflow, and that action attempts to create a tag, the repo of the calling action is acted upon, even though it's clearly been deleted by checkout.

Here's an example. This action is in a repo called SP_CAL-transform:

    - uses: actions/checkout@v4
      with:
        fetch-depth: 0
        repository: <internal>/SP_CAL-transform
        ref: ${{ inputs.deployBranch }}
        show-progress: 'false'
        token: ${{ env.GITHUB_PAT }}

    - name: Build, dockerize and push to artifactory
       run: <do some stuff>

     - name: Get workspace sha
      run: |
        echo "WORKSPACE_SHA=$(/usr/bin/git log -1 --format='%H')" >> $GITHUB_ENV

    - name: Tag the commit with the version
      uses: rickstaa/action-create-tag@v1
      with:
        tag: ${{ env.DEPLOY_VERSION }}
        commit_sha: ${{ env.WORKSPACE_SHA }}

Assume this is called from a workflow in the SP_sched_core repo.

In the Run actions/checkout@4 logs, the SP_sched_core repo is deleted, and the SP_CAL-transform repo is checked out:

Deleting the contents of '/home/runner/work/SP_sched_core/SP_sched_core'
...
Fetching the repository
From https://github.com/AAInternal/SP_CAL-transform
...

But when the action-create-tag is executed, it tries to push to the non-existent SP_sched_core:

[action-update-semver] Setup git user name and email.
[action-create-tag] Create tag '1.0.20240622204500'.
[action-create-tag] Push tag '1.0.20240622204500'
To https://github.com/<internal>/SP_sched_core.git

To Reproduce See above.

Expected behavior I would expect the action-create-tag action to push the tag to the most-recently checked-out repository, not to the original repo from where the action is originally called.

bakoontz2 avatar Jun 22 '24 21:06 bakoontz2