Add test workflow #10
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
name: Test Move Issue Action | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
env: | |
PAT_TOKEN: ${{ secrets.PAT_TOKEN }} | |
PROJECT_URL: ${{ secrets.PROJECT_URL }} | |
jobs: | |
test_issue_mover: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Create test issue | |
id: create_issue | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ env.PAT_TOKEN }} | |
script: | | |
const issue = await github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: 'Test issue for Move Action', | |
body: 'This is a test issue created to test the Move Issue Action.', | |
labels: ['test-label'] | |
}); | |
console.log('Test issue created:', issue.data.html_url); | |
return issue.data; | |
- name: Run issue mover action | |
uses: ./ | |
env: | |
GITHUB_EVENT_NAME: "issues" | |
GITHUB_EVENT_ACTION: "labeled" | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
with: | |
github-token: ${{ env.PAT_TOKEN }} | |
project-url: ${{ env.PROJECT_URL }} | |
target-labels: "test-label" | |
target-column: "In Progress" | |
ignored-columns: "Done" | |
- name: Clean up test issue | |
if: always() | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ env.PAT_TOKEN }} | |
script: | | |
const issueNumber = ${{ fromJson(steps.create_issue.outputs.result).number }}; | |
await github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issueNumber, | |
state: 'closed' | |
}); | |
console.log('Test issue closed'); |