I created this github actions script (I’ll paste it below) to unpack any tar files that might be uploaded to a repository, but I am having some problems with it
- The workflow does not trigger on push (I have tried both with tar and non-tar files)
- When I manually trigger it, it does not unpack anything and gives me no errors
- It does give me a warning
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/setup-node@v3. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
. I read the post and I (hope) I updated the file accordingly, but the error persists.
Apologies if this code is a bit garbled, I am still actively learning github action scripts
name: Unpack Tar Files
on:
push:
paths:
- '*.tar'
pull_request:
paths:
- '*.tar'
workflow_dispatch: # Allow manual triggering of the workflow
jobs:
unpack:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Create /src directory if it doesn't exist
run: mkdir -p src
- name: List tar files
run: |
echo "Listing tar files in root directory:"
ls *.tar || echo "No tar files found"
- name: Extract tar files
run: |
for tarfile in *.tar; do
if [ -f "$tarfile" ]; then
dirname=$(basename "$tarfile" .tar)
mkdir -p "src/$dirname"
tar -xf "$tarfile" -C "src/$dirname"
echo "Unpacked $tarfile into src/$dirname"
fi
done
I have also looked at these, if that helps
-
-
GitHub Actions run on push to all branches
-
GitHub Action workflow not running
Thanks for any help!