diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml new file mode 100644 index 0000000..ea805e6 --- /dev/null +++ b/.github/workflows/test-action.yml @@ -0,0 +1,22 @@ + +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' + channellName: 'bifrost' + message: 'testing action' + webhookUrl: ${{ secrets.HUBOT_WEBHOOK_URl }} + webhookAuth: ${{ secrets.HUBOT_WEBHOOK_AUTH }} diff --git a/README.md b/README.md index b09d23b..d6c0535 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/badges/coverage.svg b/badges/coverage.svg index 1063f3d..8c73e34 100644 --- a/badges/coverage.svg +++ b/badges/coverage.svg @@ -1 +1 @@ -Coverage: 36.36%Coverage36.36% \ No newline at end of file +Coverage: 33.33%Coverage33.33% \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 30b8624..ac54050 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2761,9 +2761,10 @@ async function createThread() { try { const webhookUrl = core.getInput('webhookUrl'); const webhookAuth = core.getInput('webhookAuth'); - await fetch(webhookUrl, { + const response = await fetch(webhookUrl, { method: 'POST', headers: { + 'Content-type': 'application/json', Accept: 'application/json', Authorization: webhookAuth }, @@ -2773,6 +2774,7 @@ async function createThread() { message: core.getInput('message') }) }); + core.info(await response.text()); core.info('Thread created'); } catch (error) { diff --git a/src/main.ts b/src/main.ts index 836287c..d6ab1b5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,9 +9,10 @@ export async function createThread(): Promise { 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 }, @@ -22,6 +23,7 @@ export async function createThread(): Promise { }) }) + core.info(await response.text()) core.info('Thread created') } catch (error) { // Fail the workflow run if an error occurs