Skip to content

Commit

Permalink
build: Copy output file to GitHub runner (#103)
Browse files Browse the repository at this point in the history
This change streamlines the GitHub Actions workflow and enhances the
output handling of the analyser:

1. Removed unnecessary file checking steps from the `action-preview.yml`
workflow file.
2. Simplified the `run.sh` script by:
   - Removing debug echo statements and environment variable printing
   - Adding a step to check the output using `ls -a`
- Implementing a step to copy the `repository_statistics.json` file to
the GitHub workspace

These modifications improve the efficiency of the workflow and ensure
that the analysis results are properly stored in the expected location.

fixes #104
  • Loading branch information
JackPlowman committed Sep 30, 2024
1 parent c9aa465 commit 4c8f27f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/action-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,3 @@ jobs:
uses: JackPlowman/github-stats-analyser@main
with:
repository_owner: ${{ github.repository_owner }}

- name: Check Files
run: |
ls -la
ls -la statistics
ls -la cloned_repositories
ls -la analyser
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ author: "Jack Plowman"
runs:
using: "docker"
image: "Dockerfile"
env:
GITHUB_ACTION: "true"
inputs:
github_token:
description: "The GitHub token"
Expand Down
21 changes: 14 additions & 7 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#!/bin/sh
set -e +x

cd ..
cd ..
# Echo cwd
echo "Current working directory: $(pwd)"
# Show files
ls -la

printenv

if [ "$GITHUB_ACTION" = "true" ]; then
# if running in GitHub Actions, change to the root of the repository
cd ..
cd ..
fi

# Run the analyser
python -m analyser

# Check the output
ls -a

if [ "$GITHUB_ACTION" = "true" ]; then
# if running in GitHub Actions, copy the output to the output directory
cp statistics/repository_statistics.json github/workspace/repository_statistics.json
fi

0 comments on commit 4c8f27f

Please sign in to comment.