Skip to content

Added Issue type to workflow #263

Added Issue type to workflow

Added Issue type to workflow #263

Workflow file for this run

name: Auto Label Issues and PRs
on:
pull_request_target:
types: [opened]
issues:
types: [opened]
permissions:
issues: write
pull-requests: write
jobs:
add-labels:
runs-on: ubuntu-latest
steps:
- name: Add labels to PR
if: github.event_name == 'pull_request_target'
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
await github.rest.issues.addLabels({
...context.repo,
issue_number: prNumber,
labels: ["recode", "level 1", "hacktoberfest-accepted"]
});
console.log(`Added labels [recode, level 1,hacktoberfest-accepted] to PR #${prNumber}`);
- name: Add labels to Issue
if: github.event_name == 'issues'
uses: actions/github-script@v7
with:
script: |
const issueNumber = context.payload.issue.number;
await github.rest.issues.addLabels({
...context.repo,
issue_number: issueNumber,
labels: ["recode", "level 1", "hacktoberfest-accepted"]
});
console.log(`Added labels [recode, level 1, hacktoberfest-accepted] to Issue #${issueNumber}`);
- name: Set Issue Type to Bug
if: github.event_name == 'issues'
run: |
ISSUE_NUMBER=${{ github.event.issue.number }}
REPO=${{ github.repository }}
TOKEN=${{ secrets.GITHUB_TOKEN }}
curl --request PATCH \
--url https://api.github.com/repos/${REPO}/issues/${ISSUE_NUMBER} \
--header "authorization: token ${TOKEN}" \
--header "content-type: application/json" \
--data '{"type":"Bug"}'