Skip to content

Commit

Permalink
ci: generate token before removing label and remove gh call
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Dec 12, 2023
1 parent 29137ac commit ee987b4
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,17 @@ jobs:
runs-on: ubuntu-latest
if: github.event.label.name == 'docs-preview'
steps:
- name: reset label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: docs-preview

- uses: tibdex/github-app-token@v2
id: generate_token
with:
app_id: ${{ secrets.DOCS_BOT_APP_ID }}
private_key: ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }}

- name: get HEAD commit for pr
id: get_commit
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
set -euo pipefail
sha="$(gh api repos/ibis-project/ibis/pulls/${{ github.event.issue.number }} --jq '.head.sha')"
echo "sha=$sha" >> "$GITHUB_OUTPUT"
- name: reset label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: docs-preview
token: ${{ steps.generate_token.outputs.token }}

- name: install nix
uses: cachix/install-nix-action@v24
Expand All @@ -48,7 +39,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.get_commit.outputs.sha }}
ref: ${{ github.event.pull_request.head.sha }}

- name: build docs
run: nix develop --ignore-environment --keep HOME -c just docs-build-all
Expand All @@ -59,7 +50,7 @@ jobs:
- name: generate url alias
id: get_alias
run: |
echo "id=pr-${{ github.event.pull_request.number }}-${{ steps.get_commit.outputs.sha }}" >> "$GITHUB_OUTPUT"
echo "id=pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
- name: build and push quarto docs to preview url
run: netlify deploy --dir=docs/_output --alias="${{ steps.get_alias.outputs.id }}"
Expand Down

0 comments on commit ee987b4

Please sign in to comment.