chore: bump eslint from 9.38.0 to 10.3.0 #814
Workflow file for this run
This file contains hidden or 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: Auto Label Issues and PRs | |
| on: | |
| pull_request_target: | |
| types: [opened] | |
| issues: | |
| types: [opened] | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| repository-projects: 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: ["in-review", "level 1", "recode"] | |
| }); | |
| console.log(`Added labels [in-review, level 1, recode] to PR #${prNumber}`); | |
| - name: Set Milestone on PR | |
| if: github.event_name == 'pull_request_target' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const milestoneName = "recode:launch 3.0"; | |
| const { data: milestones } = await github.rest.issues.listMilestones({ | |
| ...context.repo, | |
| state: "open", | |
| per_page: 100 | |
| }); | |
| const milestone = milestones.find(m => m.title === milestoneName); | |
| if (milestone) { | |
| await github.rest.issues.update({ | |
| ...context.repo, | |
| issue_number: prNumber, | |
| milestone: milestone.number | |
| }); | |
| console.log(`Set milestone '${milestoneName}' (number: ${milestone.number}) on PR #${prNumber}`); | |
| } else { | |
| console.log(`Milestone '${milestoneName}' not found; skipping.`); | |
| } | |
| - name: Add PR to Projects | |
| if: github.event_name == 'pull_request_target' | |
| continue-on-error: true | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }} | |
| script: | | |
| const prNodeId = context.payload.pull_request.node_id; | |
| const owner = context.repo.owner; | |
| const projectNames = ["@recode-web", "Recode Public Roadmap"]; | |
| // Query organization projects (Projects v2) | |
| const query = ` | |
| query($owner: String!) { | |
| organization(login: $owner) { | |
| projectsV2(first: 100) { | |
| nodes { | |
| id | |
| title | |
| } | |
| } | |
| } | |
| } | |
| `; | |
| let projects = []; | |
| try { | |
| const result = await github.graphql(query, { owner }); | |
| projects = result.organization.projectsV2.nodes; | |
| } catch (err) { | |
| console.log(`Could not fetch org projects: ${err.message}`); | |
| } | |
| for (const projectName of projectNames) { | |
| const project = projects.find(p => p.title === projectName); | |
| if (project) { | |
| try { | |
| await github.graphql(` | |
| mutation($projectId: ID!, $contentId: ID!) { | |
| addProjectV2ItemById(input: { projectId: $projectId, contentId: $contentId }) { | |
| item { id } | |
| } | |
| } | |
| `, { projectId: project.id, contentId: prNodeId }); | |
| console.log(`Added PR to project '${projectName}'`); | |
| } catch (err) { | |
| console.log(`Could not add PR to project '${projectName}': ${err.message}`); | |
| } | |
| } else { | |
| console.log(`Project '${projectName}' not found; skipping.`); | |
| } | |
| } | |
| - 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"] | |
| }); | |
| console.log(`Added labels [recode, level 1] 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"}' |