Skip to content

Commit

Permalink
Merge branch 'main' into stall_workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Poojita-Raj authored Sep 22, 2023
2 parents a63e924 + d2c907a commit cd1e16c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Label PR with Linked Issue Labels
on:
pull_request:
types: [opened]

jobs:
label_pr_with_issue_labels:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get linked issue number
id: extract_issue
run: echo "::set-output name=issue_number::$(jq -r '.issue.number' $GITHUB_EVENT_PATH)"

- name: Get issue labels
id: extract_labels
run: |
token=$GITHUB_TOKEN
issue_number=${{ steps.extract_issue.outputs.issue_number }}
labels=$(curl -s -H "Authorization: token $token" "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$issue_number/labels" | jq -r '.[].name')
echo "::set-output name=issue_labels::$labels"
- name: Label PR with issue labels
uses: actions/github-script@v5
with:
github_token: ${{ secrets.GH_TOKEN }}
script: |
const issueLabels = "${{ steps.extract_labels.outputs.issue_labels }}".split("\n").filter(Boolean);
const prNumber = context.payload.pull_request.number;
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: issueLabels
});
2 changes: 1 addition & 1 deletion .github/workflows/poc-checklist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
issues: write
steps:
- name: Add comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.issue.number }}
body: |
Expand Down

0 comments on commit cd1e16c

Please sign in to comment.