name: Changelog
on:
issue_comment:
types: [created]
jobs:
edit:
name: add entry
if: ${{ startsWith(github.event.comment.body, '@votca-bot changelog:') }}
runs-on: ubuntu-latest
steps:
- name: Check if message comes from PR
uses: octokit/request-action@v2.x
id: issue_info
with:
route: GET /repos/:repository/issues/:pull_number
repository: ${{ github.repository }}
pull_number: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get PR info
if: ${{ fromJSON(steps.issue_info.outputs.data).pull_request }}
uses: octokit/request-action@v2.x
id: pr_info
with:
route: GET /repos/:repository/pulls/:pull_number
repository: ${{ github.repository }}
pull_number: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout head branch from PR
if: ${{ fromJSON(steps.issue_info.outputs.data).pull_request }}
uses: actions/checkout@v2.2.0
with:
repository: ${{ fromJSON(steps.pr_info.outputs.data).head.repo.full_name }}
ref: ${{ fromJSON(steps.pr_info.outputs.data).head.ref }}
token: ${{ secrets.VOTCA_BOT_TOKEN }}
- name: Create and commit changelog entry
if: ${{ fromJSON(steps.issue_info.outputs.data).pull_request }}
uses: votca/actions/changelog@master
with:
message: ${{ github.event.comment.body }}
pr_number: ${{ github.event.issue.number }}