Add test workflow #1
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: # Allows manual triggering | |
jobs: | |
test-move-issue: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Create test issue | |
id: create-issue | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_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.' | |
}); | |
console.log(`Created issue #${issue.data.number}`); | |
return issue.data.number; | |
- name: Test adding target label | |
uses: ./ | |
with: | |
github-token: ${{ secrets.PAT_TOKEN }} | |
project-url: ${{ secrets.PROJECT_URL }} | |
target-labels: "test-label" | |
target-column: "In Progress" | |
ignored-columns: "Done" | |
- name: Add test label | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: ${{steps.create-issue.outputs.result}}, | |
labels: ['test-label'] | |
}); | |
console.log('Added test-label to the issue'); | |
- name: Test removing target label | |
uses: ./ | |
with: | |
github-token: ${{ secrets.PAT_TOKEN }} | |
project-url: ${{ secrets.PROJECT_URL }} | |
target-labels: "test-label" | |
target-column: "In Progress" | |
ignored-columns: "Done" | |
default-column: "To Do" | |
- name: Remove test label | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
await github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: ${{steps.create-issue.outputs.result}}, | |
name: 'test-label' | |
}); | |
console.log('Removed test-label from the issue'); | |
- name: Clean up | |
if: always() | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
await github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: ${{steps.create-issue.outputs.result}}, | |
state: 'closed' | |
}); | |
console.log('Closed the test issue'); |