Skip to content

Update which requirement from 4 to 5 #62

Update which requirement from 4 to 5

Update which requirement from 4 to 5 #62

Workflow file for this run

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
name: Compile + Sync Docs
on:
pull_request:
types:
- opened
- reopened
- closed
- synchronize
push:
branches:
- master
jobs:
notify-docs:
runs-on: ubuntu-latest
steps:
# Checkout is always needed, for the notify step
- name: "Checkout"
uses: actions/checkout@v3
# This is just a sanity check to make sure that the follow-up docs generation doesn't break.
# So we use the Rust version provided by the GitHub runners, which hopefully is >= MSRV.
- name: "Compile"
if: github.event_name == 'pull_request' && github.event.action != 'closed'
run: cargo check -p gdnative --features async,serde,inventory
# Pushed to master: no PR-related information
- name: "Construct JSON (for master)"
if: github.ref == 'refs/heads/master'
run: |
payload=$(cat <<'HEREDOC'
{
"op": "put",
"repo": "gdnative",
"repo-owner": "${{ github.repository_owner }}",
"num": "master",
"commit-sha": "${{ github.sha }}",
"date": "${{ github.event.head_commit.timestamp }}"
}
HEREDOC)
echo "VAR=$payload"
echo "GDNATIVE_JSON<<HEREDOC" >> $GITHUB_ENV
echo "${payload}" >> $GITHUB_ENV
echo "HEREDOC" >> $GITHUB_ENV
# Opened/reopened/updated PR: include PR author + title
- name: "Construct JSON (for PR sync)"
if: github.event_name == 'pull_request' && github.event.action != 'closed'
# jq escapes backticks, double quotes etc. in PR title.
run: |
payload=$(jq -n \
--arg repoOwner '${{ github.repository_owner }}' \
--arg num '${{ github.event.number }}' \
--arg commitSha '${{ github.event.pull_request.head.sha }}' \
--arg date '${{ github.event.pull_request.updated_at }}' \
--arg prAuthor '${{ github.event.pull_request.user.login }}' \
--arg prTitle '${{ github.event.pull_request.title }}' \
'{
"op": "put",
"repo": "gdnative",
"repo-owner": $repoOwner,
"num": $num,
"commit-sha": $commitSha,
"date": $date,
"pr-author": $prAuthor,
"pr-title": $prTitle
}')
echo "VAR=$payload"
echo "GDNATIVE_JSON<<HEREDOC" >> $GITHUB_ENV
echo "${payload}" >> $GITHUB_ENV
echo "HEREDOC" >> $GITHUB_ENV
# Closed/merged PR: no more PR-related information necessary, as it will be removed
- name: "Construct JSON (for closed PR)"
if: github.event_name == 'pull_request' && github.event.action == 'closed'
run: |
payload=$(cat <<'HEREDOC'
{
"op": "delete",
"repo": "gdnative",
"repo-owner": "${{ github.repository_owner }}",
"num": "${{ github.event.number }}",
"date": "${{ github.event.pull_request.updated_at }}"
}
HEREDOC)
echo "VAR=$payload"
echo "GDNATIVE_JSON<<HEREDOC" >> $GITHUB_ENV
echo "${payload}" >> $GITHUB_ENV
echo "HEREDOC" >> $GITHUB_ENV
- name: "Print payload"
run: |
echo "$GDNATIVE_JSON"
- name: "Prepare request"
run: |
token=$(cat .github/external-config/public-docs-token.txt | base64 -w0 -d)
echo "DOCS_GENERATOR_TOKEN=github_pat_$token" >> $GITHUB_ENV
- name: "Notify doc workflow"
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ env.DOCS_GENERATOR_TOKEN }}
repository: godot-rust/dispatch-forwarder
event-type: 'Generate docs'
client-payload: ${{ env.GDNATIVE_JSON }}