Skip to content

Commit 2d89e83

Browse files
authored
Merge pull request #10 from devicons/develop
release new version v2.1
2 parents 0cdfdcd + 61c42de commit 2d89e83

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

.github/workflows/demo.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
name: Demo the action
2-
on: workflow_dispatch
2+
on: push
33
jobs:
44
demo:
55
name: Demo the repo's capability
66
runs-on: ubuntu-18.04
77
steps:
8+
- uses: actions/checkout@v2
89
- name: Upload a single file
9-
uses: devicons/public-upload-to-imgur@v2
10+
uses: devicons/public-upload-to-imgur@develop
1011
id: step_1
1112
with:
12-
path: ./docs/example.png
13+
path: ./docs/example.PNG
1314
client_id: ${{secrets.IMGUR_CLIENT_ID}}
1415
- name: Upload a folder with multiple files
15-
uses: devicons/public-upload-to-imgur@v2
16+
uses: devicons/public-upload-to-imgur@develop
1617
id: step_2
1718
with:
1819
path: ./docs/
1920
client_id: ${{secrets.IMGUR_CLIENT_ID}}
2021
- name: Upload a glob pattern
21-
uses: devicons/public-upload-to-imgur@v2
22+
uses: devicons/public-upload-to-imgur@develop
2223
id: step_3
2324
with:
24-
path: ./*.png
25+
path: ./*/*.png
2526
client_id: ${{secrets.IMGUR_CLIENT_ID}}
2627
- name: View results
2728
env:
28-
STEP_1_RESULT: ${{ fromJSON(steps.step_1.outputs.imgurls)[0] }} # view only one result
29-
STEP_2_RESULT: ${{ steps.step_2.outputs.imgurls }}
30-
STEP_3_RESULT: ${{ steps.step_3.outputs.imgurls }}
29+
STEP_1_RESULT: ${{ fromJSON(steps.step_1.outputs.imgur_urls)[0] }} # view only one result
30+
STEP_2_RESULT: ${{ steps.step_2.outputs.imgur_urls }}
31+
STEP_3_RESULT: ${{ steps.step_3.outputs.imgur_urls }}
3132
run: |
32-
echo $STEP1_RESULT
33-
echo $STEP2_RESULT
34-
echo $STEP3_RESULT
33+
echo $STEP_1_RESULT
34+
echo $STEP_2_RESULT
35+
echo $STEP_3_RESULT

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Here's an usecase from our [devicon](https://github.com/devicons/devicon) repo:
102102

103103
![GitHub bot using the action](docs/example.PNG)
104104

105-
You can also view the [example workflow]() and the [resulting action]() in this repo.
105+
You can also view the [example workflow](https://github.com/devicons/public-upload-to-imgur/blob/main/.github/workflows/demo.yml) and the [resulting action](https://github.com/devicons/public-upload-to-imgur/actions/runs/453537510) in this repo.
106106

107107
## Credits ##
108108
The script for parsing multiple paths and glob inputs was taken from the [upload-artifacts](https://github.com/actions/upload-artifact/blob/main/src/search.ts) repo.

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const core = require('@actions/core')
22
const axios = require('axios')
33
const fs = require('fs')
44
const search = require("./search")
5+
const path = require("path")
56

67
main().catch(err => {
78
core.setFailed(err);
@@ -14,20 +15,18 @@ async function main() {
1415
core.getInput('path')
1516
)
1617
const img_paths = result.filesToUpload
17-
18-
console.log("Found these images: \n", img_paths.join("\n"))
19-
if (!img_paths) {
18+
19+
if (!img_paths || img_paths.length == 0) {
2020
console.log("No image paths found. Skipping upload and exiting script.")
2121
return;
2222
}
23+
console.log("Uploading these images: \n", img_paths.join("\n"))
2324

24-
console.log("Uploading images...")
2525
let links = await Promise.all(
2626
img_paths.map(img_path => {
2727
return uploadToImgur(img_path, description, clientId)
2828
})
2929
)
30-
console.log(links);
3130
core.setOutput("imgur_urls", JSON.stringify(links))
3231
console.log("Script finished.")
3332
}

0 commit comments

Comments
 (0)