Skip to content

extracting branch name #3

extracting branch name

extracting branch name #3

name: Add Documentation Link to PR
on:
workflow_dispatch:
push:
pull_request:
types: [opened]
jobs:
add-doc-link:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Debugging information
run: |
echo "github.ref:" ${{github.ref}}
echo "github.event_name:" ${{github.event_name}}
echo "github.head_ref:" ${{github.head_ref}}
echo "github.base_ref:" ${{github.base_ref}}
- name: Extract Branch Name
id: extract_branch
run: echo "BRANCH_NAME=$(echo ${{ github.head_ref }} | cut -d'/' -f3)" >> $GITHUB_ENV
- name: Add Documentation Link
id: comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body: |
Here is the documentation for this branch: [Documentation](https://ncar.github.io/micm/branch/${{ env.BRANCH_NAME }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}