api.acmcsuf.com brainstorming [Do not merge] #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Request Go Documentation | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
request-documentation: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: Fetch module version | |
id: generate-comment | |
run: | | |
version=$(go mod download -json "$REPO@$REV" | jq -r .Version) | |
echo "Module version: $version" | |
echo "name=$version" >> "$GITHUB_OUTPUT" | |
link="https://pkg.go.dev/$REPO@$version" | |
comment="Documentation for this module: [GoDoc]($link)" | |
echo "comment=$(echo \"$comment\" | jq -R .)" >> "$GITHUB_OUTPUT" | |
env: | |
REPO: ${{ github.repository.full_name }} | |
REV: ${{ github.event.pull_request.base.sha }} | |
- name: Update existing issue comment | |
uses: peter-evans/find-comment@v1 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: "github-actions[bot]" | |
body-includes: ${{ steps.generate-comment.outputs.comment }} | |
- name: Create or update comment | |
if: steps.fc.outputs.comment-id == '' | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body: ${{ steps.generate-comment.outputs.comment }} | |
- name: Update comment | |
if: steps.fc.outputs.comment-id != '' | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
body: ${{ steps.generate-comment.outputs.comment }} |