Skip to content

Commit 6c42d5b

Browse files
authored
Merge pull request #13 from XenoS-ITA/zip-creation-and-assetName
Zip creation and asset name
2 parents d0908ba + 486ee3c commit 6c42d5b

File tree

14 files changed

+93781
-56528
lines changed

14 files changed

+93781
-56528
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
cfx-portal-upload:
4848
name: GitHub Actions Test
4949
runs-on: ubuntu-latest
50+
if: github.event_name == 'push'
5051

5152
steps:
5253
- name: Checkout

README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,17 @@ CFX provides API keys for this action.
2323
1. Navigate to the **Cookies** section and search for `_t`.
2424
1. Copy the value of this cookie and save it in GitHub Secrets as
2525
`FORUM_COOKIE`.
26-
1. Use the action in your workflow:
26+
1. Use the action in your workflow (remember to
27+
[checkout](https://github.com/actions/checkout) before!):
2728

2829
```yaml
2930
- name: Upload Escrow Resource
3031
uses: Tynopia/cfx-portal-upload
3132
with:
3233
cookie: ${{ secrets.FORUM_COOKIE }}
33-
zipPath: /path/to/your/zip
34-
assetId: 489345
34+
assetName: 'my_asset'
3535
```
3636
37-
1. Additionally, you can configure the `chunkSize` option.
38-
3937
> [!IMPORTANT]
4038
>
4139
> When you log out of the forum, the cookie will become invalid, causing the
@@ -44,12 +42,20 @@ CFX provides API keys for this action.
4442
4543
## Input Parameters
4644
47-
| Key | Value | How to get it |
48-
| -------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
49-
| cookie | The Forum Cookie to authenticate | Go to [forum.cfx.re](https://forum.cfx.re) and inspect the page with your browser's dev tools. Then search for the `_t` cookie. |
50-
| zipPath | The path to your ZIP file that should be uploaded | This is the file location of your packed ZIP file inside the Workflow Container, usually stored in `/home/...`. |
51-
| assetId | The Asset ID, which is a unique ID in the portal | The Asset ID can be found at [portal.cfx.re](https://portal.cfx.re/assets/created-assets). ![image](https://github.com/user-attachments/assets/4176b7e7-cfbb-4e14-a488-04c4301f6082) |
52-
| chunkSize (Optional) | How large one chunk is for upload. Default: 2097152 bytes | |
45+
| Key | Type | Value | Description |
46+
| ---------- | -------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
47+
| cookie | string | The Forum Cookie to authenticate | Go to [forum.cfx.re](https://forum.cfx.re) and inspect the page with your browser's dev tools. Then search for the `_t` cookie. |
48+
| makeZip | boolean? | Automatically ZIP the full repository to upload it (default: true) | This will remove the folders `.git/`/`.github/`/`.vscode/` from the repository before zipping. |
49+
| assetName | string | The asset name to re-upload | This is the name of the asset you want to re-upload. |
50+
| assetId | number | The Asset ID, which is a unique ID in the portal | The Asset ID can be found at [portal.cfx.re](https://portal.cfx.re/assets/created-assets). ![image](https://github.com/user-attachments/assets/4176b7e7-cfbb-4e14-a488-04c4301f6082) |
51+
| zipPath | string? | The path to your ZIP file that should be uploaded | This is the file location of your packed ZIP file inside the Workflow Container, usually stored in `/home/...`. |
52+
| maxRetries | number? | The maximum number of retries. (default: 3) | This is the maximum number of times the login will be retried if it fails. |
53+
| chunkSize | number? | How large one chunk is for upload. Default: 2097152 bytes | |
54+
55+
> [!NOTE]
56+
>
57+
> `?` after the type indicates that the parameter is optional. if no assetName
58+
> or assetId is provided, the repository name will be used as assetName.
5359

5460
## How to Contribute
5561

__tests__/main.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,13 @@ describe('action', () => {
5353
switch (name) {
5454
case 'chunkSize':
5555
return '1024'
56+
case 'makeZip':
57+
return 'true'
58+
case 'maxRetries':
59+
return '1'
5660
case 'cookie':
5761
case 'assetId':
62+
case 'assetName':
5863
case 'zipPath':
5964
return 'test-value'
6065
default:

action.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,27 @@ inputs:
1010
cookie:
1111
description: 'Your Forum Account Cookie'
1212
required: true
13+
makeZip:
14+
description:
15+
'Automatically zip the full repository to upload it (true or false)'
16+
required: false
17+
default: true
18+
assetName:
19+
description: 'The asset name to re-upload'
20+
required: false
21+
maxRetries:
22+
description: 'The maximum number of retries'
23+
required: false
24+
default: 3
1325
zipPath:
1426
description: 'The path to the zip file to upload'
15-
required: true
27+
required: false
1628
assetId:
1729
description: 'The asset id to re-upload'
18-
required: true
30+
required: false
1931
chunkSize:
2032
description: 'The chunk size to split the file into'
21-
required: true
33+
required: false
2234
default: 2097152
2335

2436
runs:

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)