-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for labels and existing PR check (v2 from master) (#61)
* Added support for labels and existing PR check * fixed strings comparison in bash * fixed strings comparison in bash * Updated change log * fixed CI * fixed CI Co-authored-by: Vitaliy Litovskyi <[email protected]>
- Loading branch information
1 parent
1737745
commit 0afa85c
Showing
7 changed files
with
145 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,3 +113,84 @@ jobs: | |
https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create-pr-with-reviewers.outputs.number }} \ | ||
-d '{"state":"closed"}' | ||
if: always() | ||
|
||
create-pr-with-labels: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: | | ||
git config user.email [email protected] | ||
git config user.name "GitHub actions" | ||
git checkout -b feature/test/${{ github.sha }}-labels | ||
echo date > current-date.txt | ||
git add current-date.txt | ||
git commit --message "Some changes" | ||
git push origin feature/test/${{ github.sha }}-labels | ||
- uses: ./ | ||
id: create-pr-with-labels | ||
with: | ||
head: feature/test/${{ github.sha }}-labels | ||
title: Testing commit ${{ github.sha }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
labels: label1,label2 | ||
- name: Validate that PR exists | ||
run: curl --fail https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create-pr-with-labels.outputs.number }} | ||
- name: Close PR | ||
run: | | ||
curl \ | ||
-X PATCH \ | ||
-H 'Accept: application/vnd.github.v3+json' \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Content-Type: application/json" \ | ||
https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create-pr-with-labels.outputs.number }} \ | ||
-d '{"state":"closed"}' | ||
if: always() | ||
|
||
do-not-fail-on-existing_pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: | | ||
git config user.email [email protected] | ||
git config user.name "GitHub actions" | ||
git checkout -b feature/test/${{ github.sha }}-idempotent-case | ||
echo date > current-date.txt | ||
git add current-date.txt | ||
git commit --message "Some changes" | ||
git push origin feature/test/${{ github.sha }}-idempotent-case | ||
- uses: ./ | ||
id: create-pr | ||
with: | ||
head: feature/test/${{ github.sha }}-idempotent-case | ||
title: Testing commit ${{ github.sha }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Validate that PR exists | ||
run: curl --fail https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create-pr.outputs.number }} | ||
- uses: ./ | ||
id: second-create-pr | ||
with: | ||
head: feature/test/${{ github.sha }}-idempotent-case | ||
title: Testing commit ${{ github.sha }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Validate that only first PR is created | ||
run: | | ||
if [ "${{ steps.create-pr.outputs.created }}" != "true" ] | ||
then | ||
echo "First PR is not created: ${{ steps.create-pr.outputs.created }}" | ||
exit 1 | ||
fi | ||
if [ "${{ steps.second-create-pr.outputs.created }}" != "false" ] | ||
then | ||
echo "Second PR is created: ${{ steps.second-create-pr.outputs.created }}" | ||
exit 1 | ||
fi | ||
- name: Close PR | ||
run: | | ||
curl \ | ||
-X PATCH \ | ||
-H 'Accept: application/vnd.github.v3+json' \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Content-Type: application/json" \ | ||
https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create-pr.outputs.number }} \ | ||
-d '{"state":"closed"}' | ||
if: always() |
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
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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