Skip to content

Commit

Permalink
Test action
Browse files Browse the repository at this point in the history
  • Loading branch information
danibonilha committed Dec 22, 2023
1 parent 9006d87 commit b4d34c2
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test action

on: push

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Test
id: test
uses: ./
with:
threadName: 'v1.0-test'
channelName: 'bifrost'
message: 'testing action'
webhookUrl: ${{ secrets.HUBOT_WEBHOOK_URl }}
webhookAuth: ${{ secrets.HUBOT_WEBHOOK_AUTH }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ steps:
threadName: 'v1.0'
channellName: 'release'
message: 'release notes'
webhookUrl: { { secrets.WEBHOOK_URL } }
webhookAuth: { { secrets.WEBHOOK_AUTH } }
webhookUrl: ${{ secrets.WEBHOOK_URL }}
webhookAuth: ${{ secrets.WEBHOOK_AUTH }}
```
## Initial Local Setup
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ export async function createThread(): Promise<void> {
const webhookUrl: string = core.getInput('webhookUrl')
const webhookAuth: string = core.getInput('webhookAuth')

await fetch(webhookUrl, {
const response = await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-type': 'application/json',
Accept: 'application/json',
Authorization: webhookAuth
},
Expand All @@ -22,6 +23,10 @@ export async function createThread(): Promise<void> {
})
})

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}

core.info('Thread created')
} catch (error) {
// Fail the workflow run if an error occurs
Expand Down

0 comments on commit b4d34c2

Please sign in to comment.