Skip to content

Commit

Permalink
Fallback for pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
zerok committed Apr 18, 2024
1 parent f219224 commit 089d7ab
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/publish-techdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,25 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- id: workflow-ref
name: Determine workflow ref
if: inputs.rewrite-relative-links
shell: bash
run: |
echo "${{ github.workflow_ref }}" | awk '{split($0,a,"@");printf "workflow_ref=%s",a[2]}' >> $GITHUB_OUTPUT
ref=$(echo "${{ github.workflow_ref }}" | awk '{split($0,a,"@");printf "%s",a[2]}')
# pull request refs cannot be checked out, so we need to fall back:
if [[ "${ref}" =~ ^refs/pull/ ]]; then
printf "ref=zerok/techdocs-rewrite-relative-links-action" >> $GITHUB_OUTPUT
else
printf "ref=%s" $ref >> $GITHUB_OUTPUT
fi
- id: checkout-shared-workflows
if: inputs.rewrite-relative-links
name: Checkout shared workflows
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: grafana/shared-workflows
ref: ${{ steps.workflow-ref.outputs.workflow_ref }}
ref: ${{ steps.workflow-ref.outputs.ref }}
path: _shared-workflows

- name: Rewrite relative links
Expand Down

0 comments on commit 089d7ab

Please sign in to comment.