Skip to content

Commit aafa7f1

Browse files
authored
Change changes-workflow to run on PR (#1983)
* add changes workflow * Update update-changes.yaml * Fix changes workflow * change workflow to run on pull request * delete condition from commit & push * adding tab in beginning of line
1 parent 857d839 commit aafa7f1

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/update-changes.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
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 -e "\t* ${{ github.event.pull_request.title }} (#${{ github.event.pull_request.number }}). Thanks @${{ github.actor }}" > CHANGES2
24+
cat CHANGES >> CHANGES2
25+
mv CHANGES2 CHANGES
2326
- name: Commit & Push changes
2427
uses: actions-js/push@master
2528
with:
2629
github_token: ${{ secrets.GITHUB_TOKEN }}
27-
branch: master
28-
message: ${{ github.event.head_commit.message }}
30+
branch: ${{ github.head_ref }}
31+
message: "Update CHANGES file"

0 commit comments

Comments
 (0)