Skip to content

Commit

Permalink
fix: github actions workflow (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylc committed Jun 17, 2022
1 parent 91be4a4 commit d4d2553
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- patch
- minor
- major
- prepatch
- preminor
- premajor
required: true

jobs:
Expand All @@ -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
Expand All @@ -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}}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ interactiong with Github, set a `.env` file with the below
GITHUB_TOKEN=<my secret token>
```

## Examples

- [Github Actions worflow](.github/workflows/bump.yml)

## Credits

Big Credits to [denosaurs](https://github.com/denosaurs). This project is a fork
Expand Down
8 changes: 7 additions & 1 deletion plugins/github/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ export async function verifyToken(token: string): Promise<Response> {
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 <repo> scope" };
}
}
Expand Down

0 comments on commit d4d2553

Please sign in to comment.