-
Notifications
You must be signed in to change notification settings - Fork 5
CONT-1219 : Adding labeller.yml to for adding labels #54
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Labeller | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - labeled | ||
| - unlabeled | ||
|
|
||
| jobs: | ||
| label: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Label issues or pull requests | ||
| uses: puppetlabs/community-labeller@v0 | ||
| with: | ||
| label_name: community | ||
| label_color: '5319e7' | ||
| org_membership: puppetlabs | ||
| token: ${{ secrets.IAC_COMMUNITY_LABELER }} | ||
|
|
||
| test: | ||
|
||
| name: Validate label exists | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check for Labels | ||
| uses: actions/github-script@v6 | ||
| with: | ||
| script: | | ||
| async function getPullRequest() { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this logic not be implemented into I left some comments on puppetlabs/community-labeller#265 as well. |
||
| // Get current pull request labels | ||
| const { data: { labels } } = await github.rest.pulls.get({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: context.payload.number, | ||
| }); | ||
|
|
||
| // Log found label names | ||
| for (const label of labels) { | ||
| core.info(`Found label named '${label.name}' on pull request number ${context.payload.number}`); | ||
| } | ||
|
|
||
| // Fail workflow if no labels exist | ||
| const labelsExist = labels.length > 0; | ||
| if (!labelsExist) { | ||
| core.setFailed(`Please ensure that a label exists on pull request number ${context.payload.number}`); | ||
| } | ||
| } | ||
|
|
||
| await getPullRequest(); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow will not be triggered just on PRs to this repo, this is a reusable workflow so requires the
workflow_calltrigger also. Refer to the other workflows in this repo