Skip to content

Release 0.2.5

Release 0.2.5 #139

Workflow file for this run

name: "build-test"
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- master
- 'releases/*'
jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
npm install
npm run all
test-1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
id: filter
with:
filters: |
test:
- testzone/*.txt
- name: Check Output
run: '[[ "${{ steps.filter.outputs.test }}" = "false" ]]'
test-2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Committer Info
run: |
git config user.name 'Github Action' && \
git config user.email '[email protected]'
# add a fake commit
- name: Add Commit
run: |
mkdir testzone && \
touch testzone/touched.txt && \
git add testzone/touched.txt && \
git commit -m "add testzone/touched.txt"
- uses: ./
id: filter
with:
filters: |
test:
- testzone/*.txt
# Override ${{ github.event.pull_request.head.sha }} to HEAD for testing
head: 'HEAD'
- name: Check Output
run: |
[[ "${{ steps.filter.outputs.test }}" = "true" ]] &&
[[ "${{ steps.filter.outputs.test_files }}" = "testzone/touched.txt" ]]
# test case of issue #7
test-3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Committer Info
run: |
git config user.name 'Github Action' && \
git config user.email '[email protected]'
- name: Add Commit
id: add_commit
run: |
git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }} && \
git checkout -b this_pr && \
mkdir testzone && \
touch testzone/added_by_this_pr.txt && \
git add testzone/added_by_this_pr.txt && \
git commit -m "add by this PR" && \
echo "::set-output name=head::$(git rev-parse HEAD)"
- name: Move Base
id: move_base
run: |
git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }} && \
git checkout -b base ${{ github.event.pull_request.base.sha }} && \
mkdir testzone_1 && \
touch testzone_1/added_by_other_pr.txt && \
git add testzone_1/added_by_other_pr.txt && \
git commit -m "another merged PR" && \
echo "::set-output name=base::$(git rev-parse HEAD)" && \
git checkout this_pr
- uses: ./
id: filter
with:
# for testing, set the base to moved base, simulating the situation that the base changed (probably another PR
# got merged into the master)
base: ${{ steps.move_base.outputs.base }}
head: ${{ steps.add_commit.outputs.head }}
filters: |
this_pr:
- testzone/*.txt
test:
- testzone_1/*.txt
- name: Check Output
# Although "base" has a additional commit modifying the file matching "testzone_1/*.txt" (testzone_1/added_by_other_pr.txt),
# the file is already merged in the "base"
run: '[[ "${{ steps.filter.outputs.test }}" = "false" && "${{ steps.filter.outputs.this_pr }}" = "true" ]]'
test-4:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Committer Info
run: |
git config user.name 'Github Action' && \
git config user.email '[email protected]'
# add a fake commit
- name: Add Commit
run: |
touch a.txt && \
touch b.txt && \
git add a.txt b.txt && \
git commit -m "add txt files"
- uses: ./
id: filter
with:
filters: |
test:
- '*.txt'
a:
- a.txt
# Override ${{ github.event.pull_request.head.sha }} to HEAD for testing
head: 'HEAD'
- name: Check Output
run: |
[[ "${{ steps.filter.outputs.test }}" = "true" ]] &&
[[ "${{ steps.filter.outputs.test_files }}" = "a.txt b.txt" ]] &&
[[ "${{ steps.filter.outputs.a }}" = "true" ]] &&
[[ "${{ steps.filter.outputs.a_files }}" = "a.txt" ]]