Skip to content

Commit

Permalink
refactor!: rename devcard_id to user_id
Browse files Browse the repository at this point in the history
  • Loading branch information
omBratteng committed Feb 14, 2024
1 parent 9aa71fd commit 1d67bef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
name: devcard.png
uses: ./
with:
devcard_id: XDCZD-PHG
user_id: XDCZD-PHG
commit_filename: devcard.png
commit_branch: main
dryrun: true
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
- name: devcard
uses: dailydotdev/action-devcard@2.3.1
with:
devcard_id: ${{ secrets.DEVCARD_ID }}
user_id: ${{ secrets.USER_ID }}
```
## Action options
### Required
- `devcard_id`: this is the unique id of the devcard, it can be found in the URL of the devcard or [here](https://app.daily.dev/api/id).
- e.g. `https://api.daily.dev/devcards/v2/0b156485612243bfa39092.3.171e276.png` where the devcard_id is `0b156485612243bfa39092.3.171e276`
- `user_id`: this is the unique id of the devcard, it can be found in the URL of the devcard or [here](https://app.daily.dev/api/id).
- e.g. `https://api.daily.dev/devcards/v2/0b156485612243bfa39092.3.171e276.png` where the user_id is `0b156485612243bfa39092.3.171e276`
- Can be found at [https://app.daily.dev/api/id](https://app.daily.dev/api/id)

### Optional
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- name: devcard
uses: dailydotdev/action-devcard@2.3.1
with:
devcard_id: ${{ secrets.DEVCARD_ID }}
user_id: ${{ secrets.USER_ID }}
commit_branch: devcard
commit_filename: devcard.png
commit_message: "chore: update ${filename}"
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ branding:
icon: user-check
color: gray-dark
inputs:
devcard_id:
description: 'The ID of the devcard'
user_id:
description: 'Your daily.dev user id'
required: true

token:
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ process.on('unhandledRejection', (error) => {
throw error
})

const devcardURL = (devcard_id: string): string =>
`https://api.daily.dev/devcards/v2/${devcard_id}.png?r=${new Date().valueOf()}&ref=action`
const devcardURL = (user_id: string): string =>
`https://api.daily.dev/devcards/v2/${user_id}.png?r=${new Date().valueOf()}&ref=action`

;(async function () {
try {
const devcard_id = core.getInput('devcard_id')
const user_id = core.getInput('user_id')
const token = core.getInput('token')
const branch = core.getInput('commit_branch')
const message = core.getInput('commit_message')
Expand All @@ -36,9 +36,9 @@ const devcardURL = (devcard_id: string): string =>

// Fetch the latest devcard
try {
const { body } = await fetch(devcardURL(devcard_id))
const { body } = await fetch(devcardURL(user_id))
if (body === null) {
const message = `Empty response from devcard URL: ${devcardURL(devcard_id)}`
const message = `Empty response from devcard URL: ${devcardURL(user_id)}`
core.setFailed(message)
console.debug(message)
process.exit(1)
Expand Down

0 comments on commit 1d67bef

Please sign in to comment.