Skip to content

Update zip-on-pr.yml #3

Update zip-on-pr.yml

Update zip-on-pr.yml #3

Workflow file for this run

name: Create Zip on Pull Request
on:
pull_request:
branches:
- main
jobs:
create-zip:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository code
- name: Check out code
uses: actions/checkout@v3
# Step 2: Get the branch name
- name: Get branch name
id: vars
run: echo "branch_name=${{ github.head_ref }}" >> $GITHUB_ENV
# Step 3: Debug file structure
- name: List files in repository
run: ls -al upwork-job-scraper/
# Step 4: Create and populate the zip file
- name: Create a zip file with specific files
run: |
mkdir upwork-job-scraper-temp
files=(
activityLog.js
background.js
errorHandling.js
icon128.png
icon48.png
jobScraping.js
manifest.json
notifications.js
sentry-init.js
sentry.js
settings.css
settings.html
settings.js
utils.js
webhook.js
)
# Copy files to temporary directory
for file in "${files[@]}"; do
if [[ -f "upwork-job-scraper/$file" ]]; then
cp "upwork-job-scraper/$file" upwork-job-scraper-temp/
else
echo "Warning: upwork-job-scraper/$file does not exist."
exit 1 # Fail the workflow if any file is missing
fi
done
# Create zip with the correct structure
cd upwork-job-scraper-temp
zip -r "../upwork-job-scraper-${{ env.branch_name }}.zip" .
cd ..
# Step 5: Upload the artifact
- name: Upload zip file as artifact
uses: actions/upload-artifact@v3
with:
name: "upwork-job-scraper-${{ env.branch_name }}"
path: "upwork-job-scraper-${{ env.branch_name }}.zip"