diff --git a/.github/workflows/release-new-action-version.yml b/.github/workflows/release-new-action-version.yml index 54de9c5..cefcc41 100644 --- a/.github/workflows/release-new-action-version.yml +++ b/.github/workflows/release-new-action-version.yml @@ -17,9 +17,12 @@ defaults: jobs: update_tag: name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes + # Remember to configure the releaseNewActionVersion environment with required approvers in the repository settings environment: name: releaseNewActionVersion runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v2 @@ -36,7 +39,7 @@ jobs: -X POST ` -H 'Content-type: application/json' ` --data '{\"text\":\"Failed to update a major tag for the ${{ github.repository }} action\"}' ` - ${{ secrets.SLACK }} + ${{ secrets.SLACK_WEBHOOK }} - name: Send slack message if: success() @@ -45,4 +48,4 @@ jobs: -X POST ` -H 'Content-type: application/json' ` --data '{\"text\":\"The ${{ steps.update-major-tag.outputs.major-tag }} tag has been successfully updated for the ${{ github.repository }} action to include changes from the ${{ env.TAG_NAME }}\"}' ` - ${{ secrets.SLACK }} \ No newline at end of file + ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index aabff78..d6f8f58 100644 --- a/dist/index.js +++ b/dist/index.js @@ -42,7 +42,7 @@ async function findTag(tag, octokitClient) { return null; } else { - throw err; + throw new Error(`Retrieving refs failed with the following error: ${err}`); } } } @@ -68,7 +68,7 @@ async function validateIfReleaseIsPublished(tag, octokitClient) { throw new Error(`No GitHub release found for the ${tag} tag`); } else { - throw err; + throw new Error(`Retrieving releases failed with the following error: ${err}`); } } } diff --git a/package-lock.json b/package-lock.json index 52dd882..ec7e015 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "publish-action", - "version": "1.0.0", + "version": "0.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 745b311..b22e3f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "publish-action", - "version": "1.0.0", + "version": "0.1.0", "description": "Update the major version tag (v1, v2, etc.) to point to the specified tag", "main": "lib/main.js", "scripts": { diff --git a/src/api-utils.ts b/src/api-utils.ts index 97a861a..fa2ca01 100644 --- a/src/api-utils.ts +++ b/src/api-utils.ts @@ -28,7 +28,9 @@ async function findTag( if (err.status === 404) { return null; } else { - throw err; + throw new Error( + `Retrieving refs failed with the following error: ${err}` + ); } } } @@ -68,7 +70,9 @@ export async function validateIfReleaseIsPublished( `No GitHub release found for the ${tag} tag` ); } else { - throw err; + throw new Error( + `Retrieving releases failed with the following error: ${err}` + ); } } }