-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (39 loc) · 1.4 KB
/
pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Zip Repository on Pull Request
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: write # Necessary permission to create releases and upload assets
jobs:
zip_and_prerelease:
runs-on: ubuntu-latest
env:
ORG_NAME: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
ZIP_NAME: ${{ github.repository_owner }}-${{ github.event.repository.name }}.zip
PR_NUMBER: ${{ github.event.number }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Create zip archive
shell: bash
run: |
echo "Organization Name: $ORG_NAME"
echo "Repository Name: $REPO_NAME"
echo "Pull Request Number: $PR_NUMBER"
echo "Zip File Name: $ZIP_NAME"
# Exclude .py files and other specified patterns
zip -r "$ZIP_NAME" ./* -x "*.py" -x "path/to/exclude/*" -x "*.md"
- name: Create Prerelease and Upload Zip
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: "pr-${{ env.PR_NUMBER }}-${{ github.sha }}"
releaseName: "Prerelease PR #${{ env.PR_NUMBER }}"
artifacts: ${{ env.ZIP_NAME }}
artifactContentType: application/zip
draft: false
prerelease: true
overwrite: true # Overwrite release if it already exists