From d4d2553f1b94254ebaa86e407af873959192ef74 Mon Sep 17 00:00:00 2001 From: Sylvain Cau <10268458+sylc@users.noreply.github.com> Date: Fri, 17 Jun 2022 22:01:10 +0800 Subject: [PATCH] fix: github actions workflow (#16) --- .github/workflows/bump.yml | 7 ++++++- README.md | 4 ++++ plugins/github/api.ts | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index 4e3df7a..58bcd2a 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -11,6 +11,9 @@ on: - patch - minor - major + - prepatch + - preminor + - premajor required: true jobs: @@ -22,6 +25,8 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Set up Deno uses: denoland/setup-deno@v1.0.0 @@ -37,4 +42,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - deno task release ${{github.event.inputs.releaseKind}} + deno task test ${{github.event.inputs.releaseKind}} diff --git a/README.md b/README.md index b8c6736..1bfb73c 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,10 @@ interactiong with Github, set a `.env` file with the below GITHUB_TOKEN= ``` +## Examples + +- [Github Actions worflow](.github/workflows/bump.yml) + ## Credits Big Credits to [denosaurs](https://github.com/denosaurs). This project is a fork diff --git a/plugins/github/api.ts b/plugins/github/api.ts index 22b6d7a..ecdded7 100644 --- a/plugins/github/api.ts +++ b/plugins/github/api.ts @@ -20,11 +20,17 @@ export async function verifyToken(token: string): Promise { if (body.message === "Bad credentials") { return { ok: false, err: "Bad credentials" }; } + + if (Deno.env.get("GITHUB_ACTION")) { + // TODO: check that the token + // provided byt github action has enough permission + // It does not seem possible currently ? + return { ok: true }; + } const scopes = res.headers.get("X-OAuth-Scopes"); if (scopes && scopes.includes("repo")) { return { ok: true }; } else { - console.log(scopes) return { ok: false, err: "Missing scope" }; } }