Skip to content

Commit

Permalink
Improve tests wip (#17)
Browse files Browse the repository at this point in the history
* edit test

* trigger on push

* add con group for linter

* more test

* quote string

* typo

* update test

* test build job

* update printing

* auto close test issues

* pr tests

* test action typo

* add a bot label
  • Loading branch information
dacbd authored Apr 23, 2022
1 parent 49c894d commit 5b965ff
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 9 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Auto Issue closer
on:
issues:
types:
- labeled
- opened
jobs:
delete-test-issues:
runs-on: ubuntu-latest
steps:
- run: |
is_test=$(echo "${{ toJSON(github.event) }}" | jq '.issue.labels[].name == "test"' | grep true)
if [[ -z "$is_test" ]]; then
curl --slient --show-error \
--request PATCH \
--header "Accept: application/vnd.github.v3+json" \
--header "Authorization: token ${{ secrets.PAT }}" \
--url "https://api.github.com/repos/dacbd/create-issue-action/issues/${{ github.event.issue.number }}" \
--data '{"state":"closed"}'
fi
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
push:
pull_request:

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
59 changes: 50 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,60 @@
name: Basic test on PR
name: Basic Tests
on:
push:
pull_request:
branches: main
workflow_dispatch:
jobs:
test:
build:
runs-on: ubuntu-latest
name: Test action on PR
steps:
- uses: actions/checkout@v2
- name: test new issue
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: |
echo "todo"
npm install
npm run build
if [[ -z $(git status --porcelain) ]]; then
echo "good"
else
echo "Forgot to commit 'npm run build'?"
git status
exit 1
fi
pr-test:
if: github.event_name == 'pull_request'
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: test
uses: ./
with:
token: ${{ github.token }}
title: Simple test issue
token: ${{ secrets.PAT }}
title: "PR test from: `${{ github.ref_name }}`"
body: |
This is a test that includes a multiline string.
Created by https://github.com/DanielBarnes/create-issue-action/actions/runs/${{ github.run_id }}
# Test
multiline
labels: test,bot
assignees: dacbd
push-test:
if: github.event_name == 'push'
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
echo "todo"
trigger-test:
if: github.event_name == 'workflow_dispatch' || github.ref_name == 'main'
runs-on: ubuntu-latest
steps:
- run: |
curl --silent --show-error \
--request POST \
--header "Authorization: token ${{ secrets.PAT }}" \
--header "Accept: application/vnd.github.v3+json" \
--url "https://api.github.com/repos/dacbd/err/dispatches" \
--data '{"event_type":"basic", "client_payload": {"ref_name":"${{ github.ref_name }}"}}'

0 comments on commit 5b965ff

Please sign in to comment.