Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Architecture] Labeler Action #625

Closed
2 tasks
eprice555 opened this issue Oct 24, 2023 · 0 comments · Fixed by #752
Closed
2 tasks

[Architecture] Labeler Action #625

eprice555 opened this issue Oct 24, 2023 · 0 comments · Fixed by #752
Assignees
Labels
🏗 architecture ✍️ documentation Improvements or additions to documentation good first issue Good for newcomers oss workflows

Comments

@eprice555
Copy link
Collaborator

eprice555 commented Oct 24, 2023

Part of the OSS Architecture track

This YAML file defines a GitHub Action that labels issues or pull requests opened by new contributors with the "new contributor" label. It uses the actions/checkout action to check out the repository, and installs the GitHub CLI to interact with the GitHub API. It then checks if the event is an issue or pull request, and adds the "new contributor" label to the issue or pull request using the gh issue add-label or gh pr add-label command, respectively.

Task

Suggestions: try this prompt with copilot "how to create a labeler GitHub Action like this one https://github.com/actions/labeler"

or

Directions: debug the following output
name: Labeler

on:
  issues:
    types: [opened]
  pull_request_target:
    types: [opened]

permissions:
  issues: write
  pull-requests: write

jobs:
  labeler:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Install GitHub CLI
        run: |
          sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
          sudo apt-add-repository https://cli.github.com/packages
          sudo apt update
          sudo apt install gh
      - name: Label issues or pull requests
        if: ${{ github.event_name == 'issues' || github.event_name == 'pull_request_target' }}
        run: |
          if [[ "${{ github.event.issue }}" != "" ]]; then
            echo "Labeling issue"
            gh issue add-label "${{ github.event.issue.number }}" "new contributor"
          elif [[ "${{ github.event.pull_request }}" != "" ]]; then
            echo "Labeling pull request"
            gh pr add-label "${{ github.event.pull_request.number }}" "new contributor"

Resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏗 architecture ✍️ documentation Improvements or additions to documentation good first issue Good for newcomers oss workflows
Projects
Status: No status
6 participants