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

chore: create action to auto-label extension and linting issues #3589

Merged
merged 2 commits into from
Aug 12, 2022
Merged
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
24 changes: 24 additions & 0 deletions .github/workflows/label-extension-linter-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Add extension and linting labels to associated opened issues

on:
issues:
types: [opened]

jobs:
label_extension_linting_issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Label Extension Issues
uses: andymckay/[email protected]
if: contains(toJson(github.event.issue.body), '### Product\n\naxe Extension\n\n')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why convert this to JSON?

Copy link
Contributor Author

@straker straker Aug 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was the only way to get matching of newlines to work. Just the body would not match any newline character combinations I tried (\n, \r\n, etc.). https://stackoverflow.com/questions/61238849/github-actions-if-contains-function-not-working-with-env-variable

You can see all the things I tried using the body and toJson https://github.com/straker/issue-template-tests/runs/7749582494?check_suite_focus=true

with:
add-labels: "extension"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Label Linting Issues
uses: andymckay/[email protected]
if: contains(toJson(github.event.issue.body), '### Product\n\naxe Linter\n\n')
with:
add-labels: "linting"
repo-token: ${{ secrets.GITHUB_TOKEN }}