Skip to content

Commit fabacb1

Browse files
authored
Fix error message and document required permission (#12)
2 parents 860394a + 101f71a commit fabacb1

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

README.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@ Upload files to a GitHub release.
66

77
```yaml
88
#
9-
steps:
10-
#
11-
- name: Upload to release
12-
uses: cloudnode-pro/[email protected]
13-
with:
14-
# See the ‘Inputs’ section below for details.
15-
gh-token: ${{ github.token }}
16-
release-id: 123456 # Optional for `release` events.
17-
files: |
18-
path/to/file.txt; type=text/plain; name=File1.txt
19-
path/to/foo/bar.baz; if=${{ github.event_name == 'release' }}
9+
jobs:
10+
publish:
11+
#
12+
permissions:
13+
contents: write
14+
#
15+
steps:
16+
#
17+
- name: Upload to release
18+
uses: cloudnode-pro/[email protected]
19+
with:
20+
# See the ‘Inputs’ section below for details.
21+
gh-token: ${{ github.token }}
22+
release-id: 123456 # Optional for `release` events.
23+
files: |
24+
path/to/file.txt; type=text/plain; name=File1.txt
25+
path/to/foo/bar.baz; if=${{ github.event_name == 'release' }}
2026
```
2127
2228
## Inputs
@@ -65,5 +71,15 @@ files: |-
6571
/path/to/file3.txt; if=${{ 'foo' == 'bar' }}
6672
```
6773

74+
### Permissions
6875

76+
Uploading release assets requires the `contents: write`.
6977

78+
See: [Controlling permissions for GITHUB_TOKEN](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token)
79+
80+
Example:
81+
82+
```yaml
83+
permissions:
84+
contents: write
85+
```

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const responses = await Promise.all(
8686
core.info("Done uploading files.");
8787
const failedUploads = responses.filter(r => !r.res.ok);
8888
if (failedUploads.length > 0) {
89-
core.error(`Failed to upload ${failedUploads} file${failedUploads.length === 1 ? "" : "s"}:`);
89+
core.error(`Failed to upload ${failedUploads.length} file${failedUploads.length === 1 ? "" : "s"}:`);
9090
for (const failed of failedUploads) {
9191
const body = await failed.res.text();
9292
let parsed: string;

0 commit comments

Comments
 (0)