Skip to content

Add test workflow

Add test workflow #5

Workflow file for this run

name: Test Move Issue Action
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: # Allows manual triggering
permissions:
contents: read
issues: write
jobs:
test-move-issue:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create test issue
id: create-issue
uses: actions/github-script@v7
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: Simulate labeled event
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issueNumber = ${{steps.create-issue.outputs.result}};
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
labels: ['test-label']
});
console.log('Added test-label to the issue');
// Simulate the labeled event payload
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber
});
return JSON.stringify({
action: 'labeled',
issue: issue.data,
label: { name: 'test-label' }
});
id: simulate-event
- name: Test adding target label
uses: ./
env:
GITHUB_EVENT_PATH: ${{ steps.simulate-event.outputs.result }}
with:
github-token: ${{ secrets.PAT_TOKEN }}
project-url: ${{ secrets.PROJECT_URL }}
target-labels: "test-label"
target-column: "In Progress"
ignored-columns: "Done"
- name: Clean up
if: always()
uses: actions/github-script@v7
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');