Release notes workflow WIP #5
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: Check release notes | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- 'main' | |
- 'release/*' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
check_release_notes: | |
#if: github.event.issue.pull_request != '' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Get github ref | |
uses: actions/github-script@v3 | |
id: get-pr | |
with: | |
script: | | |
const result = await github.pulls.get({ | |
pull_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
return { "ref": result.data.head.ref, "repository": result.data.head.repo.full_name}; | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
repository: ${{ fromJson(steps.get-pr.outputs.result).repository }} | |
ref: ${{ fromJson(steps.get-pr.outputs.result).ref }} | |
fetch-depth: 0 | |
# Did bot already commented the PR? | |
- name: Find Comment | |
uses: peter-evans/find-comment@v2.4.0 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: '<!-- DO_NOT_REMOVE: release_notes_check -->' | |
# If not, create a new comment | |
- name: Create comment | |
if: steps.fc.outputs.comment-id == '' | |
uses: peter-evans/create-or-update-comment@v3.1.0 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
<!-- DO_NOT_REMOVE: release_notes_check --> | |
This comment was written by a bot! | |
#reactions: rocket | |
# If yes, update the comment | |
- name: Update comment | |
if: steps.fc.outputs.comment-id != '' | |
uses: peter-evans/create-or-update-comment@v3.1.0 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
body: | | |
<!-- DO_NOT_REMOVE: release_notes_check --> | |
This comment has been updated! | |
#reactions: hooray |