Skip to content

Commit 009b00b

Browse files
authored
change workflow to run on pull request
1 parent bb1e147 commit 009b00b

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

.github/workflows/update-changes.yaml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
name: Update CHANGES File
22
on:
3-
push:
4-
paths-ignore:
5-
- 'CHANGES'
3+
pull_request:
4+
types: [opened]
65
branches:
76
- master
87
jobs:
98
update-changes:
109
runs-on: ubuntu-latest
1110
steps:
12-
- uses: actions/checkout@master
11+
- uses: actions/checkout@v2
1312
with:
1413
persist-credentials: false
1514
fetch-depth: 0
15+
16+
- name: Get changed files
17+
id: changed-files
18+
uses: tj-actions/[email protected]
19+
1620
- name: Update CHANGES file
21+
if: "!contains(steps.changed-files.outputs.all_changed_files, 'CHANGES')"
1722
run: |
18-
COMMIT="${{ github.event.head_commit.message }}"
19-
PR_TITLE=`echo "${COMMIT}" | head -n 1`
20-
echo "* ${PR_TITLE}" Thanks @${{ github.actor }} > TMP_CHANGES
21-
cat CHANGES >> TMP_CHANGES
22-
mv TMP_CHANGES CHANGES
23+
echo "${{ github.event.pull_request.title }}"
24+
echo "* ${{ github.event.pull_request.title }} (#${{ github.event.pull_request.number }}). Thanks @${{ github.actor }}" > CHANGES2
25+
cat CHANGES >> CHANGES2
26+
mv CHANGES2 CHANGES
2327
- name: Commit & Push changes
28+
if: "!contains(steps.changed-files.outputs.all_changed_files, 'CHANGES')"
2429
uses: actions-js/push@master
2530
with:
2631
github_token: ${{ secrets.GITHUB_TOKEN }}
27-
branch: master
28-
message: ${{ github.event.head_commit.message }}
32+
branch: ${{ github.head_ref }}
33+
message: "Update CHANGES file"

0 commit comments

Comments
 (0)