Skip to content
This repository was archived by the owner on Sep 28, 2021. It is now read-only.

Commit f2d9982

Browse files
committed
GHA: add copyright action
1 parent 8649972 commit f2d9982

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/copyright.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Copyright
2+
on:
3+
issue_comment:
4+
types: [created]
5+
jobs:
6+
edit:
7+
name: Copyright
8+
if: ${{ github.event.comment.body == '@votca-bot copyright' }}
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check if message comes from PR
12+
uses: octokit/request-action@v2.x
13+
id: issue_info
14+
with:
15+
route: GET /repos/:repository/issues/:pull_number
16+
repository: ${{ github.repository }}
17+
pull_number: ${{ github.event.issue.number }}
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
- name: Get PR info
20+
if: ${{ fromJSON(steps.issue_info.outputs.data).pull_request }}
21+
uses: octokit/request-action@v2.x
22+
id: pr_info
23+
with:
24+
route: GET /repos/:repository/pulls/:pull_number
25+
repository: ${{ github.repository }}
26+
pull_number: ${{ github.event.issue.number }}
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Checkout head branch from PR
29+
if: ${{ fromJSON(steps.issue_info.outputs.data).pull_request }}
30+
uses: actions/checkout@v2.2.0
31+
with:
32+
repository: ${{ fromJSON(steps.pr_info.outputs.data).head.repo.full_name }}
33+
ref: ${{ fromJSON(steps.pr_info.outputs.data).head.ref }}
34+
fetch-depth: 0
35+
token: ${{ secrets.VOTCA_BOT_TOKEN }}
36+
- name: Create and commit copyright updates
37+
if: ${{ fromJSON(steps.issue_info.outputs.data).pull_request }}
38+
uses: votca/actions/copyright@master
39+
with:
40+
base: ${{ fromJSON(steps.pr_info.outputs.data).base.sha }}

0 commit comments

Comments
 (0)