Files
StrikePackageGPT/.github/workflows/unpack-zip.yml

58 lines
1.7 KiB
YAML

name: Unpack files.zip
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch containing files.zip'
required: true
default: 'c2-integration'
jobs:
unpack:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
persist-credentials: true
- name: Ensure unzip available
run: sudo apt-get update -y && sudo apt-get install -y unzip rsync
- name: Verify files.zip exists
run: |
if [ ! -f files.zip ]; then
echo "ERROR: files.zip not found in repo root on branch ${{ github.event.inputs.branch }}"
exit 1
fi
echo "files.zip found:" && ls -lh files.zip
- name: Unpack files.zip
run: |
rm -rf extracted
mkdir -p extracted
unzip -o files.zip -d extracted
echo "Sample extracted files:"
find extracted -maxdepth 3 -type f | sed -n '1,200p'
- name: Copy extracted files into repository
run: |
rsync -a --exclude='.git' extracted/ .
- name: Commit and push changes (if any)
env:
BRANCH: ${{ github.event.inputs.branch }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "Unpack files.zip into branch ${BRANCH} via workflow"
git push origin "HEAD:${BRANCH}"
echo "Changes pushed."
fi