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

New package: Add Autotagging tool #48984

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/auto-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: New Package PR Workflow

on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main # Adjust the branch name as needed

jobs:
tag_new_package_pr:
runs-on: ubuntu-latest

steps:
- name: Check if PR is for a new package
id: check_new_package
run: |
pr_title=$(echo "${{ github.event.pull_request.title }}" | tr '[:upper:]' '[:lower:]')
if [[ $pr_title == *"new package"* ]]; then
echo "new_package=true" >> $GITHUB_ENV
fi

- name: Tag PR if it's for a new package
if: env.new_package == 'true'
run: |
pr_number=${{ github.event.pull_request.number }}
token=$GITHUB_TOKEN
label_name="new-package"
api_url="https://api.github.com/repos/${{ github.repository }}/issues/${pr_number}/labels"

curl -X POST \
-H "Authorization: token $token" \
-H "Accept: application/vnd.github.v3+json" \
"$api_url" \
-d "{\"labels\":[\"$label_name\"]}"