New package: Add Autotagging tool #1
Workflow file for this run
This file contains 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: 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\"]}" | |