Skip to content

docs: prepare 1.4.0 release (#292) #43

docs: prepare 1.4.0 release (#292)

docs: prepare 1.4.0 release (#292) #43

Workflow file for this run

name: Continuous integration
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: dprint/[email protected]
- uses: actions/setup-node@v1
- run: yarn install
- run: yarn test
create-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 }}
echo date > current-date.txt
git add current-date.txt
git commit --message "Some changes"
git push origin feature/test/${{ github.sha }}
- uses: ./
id: create-pr
with:
head: feature/test/${{ github.sha }}
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 }}
- 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()
create-draft-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 }}-draft
echo date > current-date.txt
git add current-date.txt
git commit --message "Some changes"
git push origin feature/test/${{ github.sha }}-draft
- uses: ./
id: create-draft-pr
with:
head: feature/test/${{ github.sha }}-draft
title: Testing commit ${{ github.sha }}
draft: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Validate that PR exists
run: |
curl \
-H 'Accept: application/vnd.github.shadow-cat-preview+json' \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create-draft-pr.outputs.number }} \
--fail \
- 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-draft-pr.outputs.number }} \
-d '{"state":"closed"}'
if: always()
create-pr-with-reviewers:
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 }}-reviewers
echo date > current-date.txt
git add current-date.txt
git commit --message "Some changes"
git push origin feature/test/${{ github.sha }}-reviewers
- uses: ./
id: create-pr-with-reviewers
with:
head: feature/test/${{ github.sha }}-reviewers
title: Testing commit ${{ github.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
reviewers: ${{ github.actor }}
- name: Validate that PR exists
run: curl --fail https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create-pr-with-reviewers.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-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()