dawidd6 / action-download-artifact

:gear: A GitHub Action to download an artifact associated with given workflow and commit or other criteria
MIT License
723 stars 210 forks source link

Downloaded and extracted artifact is not showing in repo #315

Closed COTAWebmaster closed 1 week ago

COTAWebmaster commented 3 weeks ago

Perhaps I am missing something, but following along with what documentation there is I am unable to get downloaded artifacts to show in my target repo.

The run results look successful, and inflates the items:

Run dawidd6/action-download-artifact@v6
  with:
    name: dist_assets
    github_token: ***
    repo: my-org/control-repo
    run_id: 11690180261
    workflow_search: false
    workflow_conclusion: success
    name_is_regexp: false
    path: ./
    allow_forks: false
    check_artifacts: false
    search_artifacts: false
    skip_unpack: false
    if_no_artifact_found: fail
==> Repository: my-org/control-repo
==> Artifact name: dist_assets
==> Local path: ./
==> Workflow name: 125400437
==> Workflow conclusion: success
==> Allow forks: false
==> Artifact: 2148824413
==> Downloading: dist_assets.zip (3.45 MB)
==> Extracting: dist_assets.zip

This is the workflow YAML file for the target repo:

on:
  # Listen to a repository dispatch event by the name of `dispatch-event`
  repository_dispatch:
    types: [dispatch-event]
    workflow_dispatch:
    repository_dispatch: 
jobs:
  get_assets_and_deploy:
    runs-on: ubuntu-latest
    steps:

      - uses: actions/checkout@v4.2.2
        with:
          ref: ${{ github.event.client_payload.ref }}
      - run: |
          echo ${{ github.event.client_payload.sha }} && echo ${{ github.event.client_payload.run_id }}

      - name: Get assets
        uses: dawidd6/action-download-artifact@v6 
        with:
          name: dist_assets
          github_token: ${{ secrets.THEME_WORKFLOW_TOKEN }} # token with actions:read permissions on target repo
          repo: my-org/control-repo
          run_id: ${{ github.event.client_payload.run_id }}

And this is the YAML file for the control repo:

    - name: 'Upload Artifact'
      uses: actions/upload-artifact@v4
      with:
        name: dist_assets
        path: web/app/themes/custom/dist/

    - name: Repository Dispatch
      uses: peter-evans/repository-dispatch@v3
      with:
        token: ${{ secrets.THEME_WORKFLOW_TOKEN }}
        repository: my-org/target-repo
        event-type: dispatch-event
        client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "run_id": "${{ github.run_id }}"}'

Everything appears to be working except for the unzipped items not appearing in the target repo. Am I missing something?

The artifact is able to be manually downloaded from the control repo and shows that the zip file is correct.

COTAWebmaster commented 1 week ago

It turns out that I have to git add . and then commit and push to the repo to get the artifacts to appear.