Skip to content

Commit

Permalink
🚸 automatically use GitHub token (#323)
Browse files Browse the repository at this point in the history
This PR builds on #321 and replaces the use of `@octokit/action` with
`@octokit/core`.
In addition, it adds an optional `token` input to the action that
defaults to the repositories GitHub token and is used for
authentication.
Thus, specifying the token explicitly is no longer necessary once this
PR is merged.
  • Loading branch information
burgholzer authored Sep 9, 2024
1 parent eb66033 commit 9e310fb
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 28,867 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ jobs:
cache: npm
- run: npm ci
- run: npm run all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# test action works running from the graph
test:
Expand All @@ -42,8 +40,6 @@ jobs:
- uses: actions/checkout@v4
- uses: ./
id: z3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: echo "${{ steps.z3.outputs.z3-root }}"
- run: '[ -d "${{ steps.z3.outputs.z3-root }}" ] || exit 1'
- if: runner.os != 'Windows'
Expand Down
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@ To download the latest version of Z3 for the host platform and add it to the `PA
- name: Setup Z3
id: z3
uses: cda-tum/setup-z3@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
This action creates a `z3-root` output variable that contains the path to the root directory of the Z3 installation and exports the `Z3_ROOT` environment variable for subsequent steps in a job. The output variable can be accessed as `${{ steps.z3.outputs.z3-root }}`.

> **Warning**
> The `GITHUB_TOKEN` environment variable is required to download the Z3 binaries from GitHub releases.
> The token is automatically provided by GitHub Actions and does not need to be configured manually.

### Specifying a version

In many cases, it is convenient to use a specific version of Z3. This can be done by specifying the `version` input:
Expand All @@ -30,8 +24,6 @@ In many cases, it is convenient to use a specific version of Z3. This can be don
uses: cda-tum/setup-z3@v1
with:
version: 4.11.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

> **Note**
Expand All @@ -48,8 +40,6 @@ If you want to explicitly specify the platform and architecture for which Z3 sho
with:
platform: macOS
architecture: arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

> **Note**
Expand All @@ -70,6 +60,4 @@ By default, the action only adds Z3 into `PATH`, meaning it cannot be used as a
uses: cda-tum/setup-z3@v1
with:
add_to_library_path: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ inputs:
description: "Add Z3 to the library path variables, such that it can be used as a static/dynamic library. Defaults to false."
required: false
default: "false"
token:
description: "The token that the action will use to query the GitHub API. Defaults to the repository's GitHub token."
required: false
default: ${{ github.token }}
outputs:
z3-root:
description: "The root directory of the Z3 installation"
Expand Down
Loading

0 comments on commit 9e310fb

Please sign in to comment.