forked from temporalio/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (54 loc) · 2.03 KB
/
trigger-docs.yml
File metadata and controls
61 lines (54 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Trigger CLI docs update
on:
workflow_dispatch:
release:
types: [published]
permissions:
contents: read
jobs:
update:
if: github.repository == 'temporalio/cli'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Get user info from GitHub API
id: get_user
env:
GITHUB_ACTOR: ${{ github.actor }}
run: |
echo "GitHub actor: ${GITHUB_ACTOR}"
# Query the GitHub API for the user's details.
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/users/${GITHUB_ACTOR}" > user.json
# Extract the user's full name if available, default to the username otherwise.
git_name=$(jq -r '.name // empty' user.json)
if [ -z "$git_name" ]; then
git_name="${GITHUB_ACTOR}"
fi
git_email="${GITHUB_ACTOR}@users.noreply.github.com"
# Set the outputs for subsequent steps.
echo "GIT_NAME=$git_name" >> "$GITHUB_OUTPUT"
echo "GIT_EMAIL=$git_email" >> "$GITHUB_OUTPUT"
- name: Generate token
id: generate_token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }}
private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
# Generate a token with permissions to trigger GHA in documentation repo.
repositories: |
documentation
- name: Trigger Documentation Workflow
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
gh workflow run update-cli-docs.yml \
-R temporalio/documentation \
-r main \
-f cli_release_tag="${{ github.ref_name }}" \
-f commit_author="${{ steps.get_user.outputs.GIT_NAME }}" \
-f commit_author_email="${{ steps.get_user.outputs.GIT_EMAIL }}" \
-f commit_message="Update CLI docs for release ${{ github.ref_name }}"