forked from kunjgit/GameZone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into GuessTheSong-PR1
- Loading branch information
Showing
65 changed files
with
2,544 additions
and
1,363 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,78 @@ | ||
name: Pull Request Labels | ||
# name: Pull Request Labels | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
# on: | ||
# pull_request_target: | ||
# types: | ||
# - opened | ||
# - synchronize | ||
|
||
jobs: | ||
pr-validation: | ||
runs-on: ubuntu-latest | ||
# jobs: | ||
# pr-validation: | ||
# runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
# - name: Set up Node.js | ||
# uses: actions/setup-node@v2 | ||
# with: | ||
# node-version: '14' | ||
|
||
- name: Install dependencies | ||
run: npm install --prefix .github octokit | ||
# - name: Install dependencies | ||
# run: npm install --prefix .github octokit | ||
|
||
- name: Fetch related issue and labels | ||
id: fetch_issue | ||
uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
script: | | ||
const prNumber = context.payload.pull_request.number; | ||
const repoOwner = context.payload.repository.owner.login; | ||
const repoName = context.payload.repository.name; | ||
# - name: Fetch related issue and labels | ||
# id: fetch_issue | ||
# uses: actions/github-script@v4 | ||
# with: | ||
# github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
# script: | | ||
# const prNumber = context.payload.pull_request.number; | ||
# const repoOwner = context.payload.repository.owner.login; | ||
# const repoName = context.payload.repository.name; | ||
|
||
const { data: pr } = await github.pulls.get({ | ||
owner: repoOwner, | ||
repo: repoName, | ||
pull_number: prNumber | ||
}); | ||
# const { data: pr } = await github.pulls.get({ | ||
# owner: repoOwner, | ||
# repo: repoName, | ||
# pull_number: prNumber | ||
# }); | ||
|
||
const issueNumber = pr.body.match(/#([0-9]+)/)[1]; | ||
# const issueNumber = pr.body.match(/#([0-9]+)/)[1]; | ||
|
||
const { data: issue } = await github.issues.get({ | ||
owner: repoOwner, | ||
repo: repoName, | ||
issue_number: issueNumber | ||
}); | ||
# const { data: issue } = await github.issues.get({ | ||
# owner: repoOwner, | ||
# repo: repoName, | ||
# issue_number: issueNumber | ||
# }); | ||
|
||
return { | ||
issue: issue, | ||
prNumber: prNumber, | ||
repoOwner: repoOwner, | ||
repoName: repoName | ||
}; | ||
# return { | ||
# issue: issue, | ||
# prNumber: prNumber, | ||
# repoOwner: repoOwner, | ||
# repoName: repoName | ||
# }; | ||
|
||
- name: Apply labels to PR | ||
if: | | ||
steps.fetch_issue.outputs.issue.labels.some(function(label) { | ||
return label.name.toLowerCase() === 'gssoc'; | ||
}) | ||
run: | | ||
const issueLabels = steps.fetch_issue.outputs.issue.labels; | ||
const prNumber = steps.fetch_issue.outputs.prNumber; | ||
const repoOwner = steps.fetch_issue.outputs.repoOwner; | ||
const repoName = steps.fetch_issue.outputs.repoName; | ||
# - name: Apply labels to PR | ||
# if: | | ||
# steps.fetch_issue.outputs.issue.labels.some(function(label) { | ||
# return label.name.toLowerCase() === 'gssoc'; | ||
# }) | ||
# run: | | ||
# const issueLabels = steps.fetch_issue.outputs.issue.labels; | ||
# const prNumber = steps.fetch_issue.outputs.prNumber; | ||
# const repoOwner = steps.fetch_issue.outputs.repoOwner; | ||
# const repoName = steps.fetch_issue.outputs.repoName; | ||
|
||
const prLabels = issueLabels.filter(function(label) { | ||
return label.name.toLowerCase().startsWith('level'); | ||
}); | ||
prLabels.push('gssoc'); | ||
await github.issues.addLabels({ | ||
owner: repoOwner, | ||
repo: repoName, | ||
issue_number: prNumber, | ||
labels: prLabels.map(function(label) { | ||
return label.name; | ||
}) | ||
}); | ||
# const prLabels = issueLabels.filter(function(label) { | ||
# return label.name.toLowerCase().startsWith('level'); | ||
# }); | ||
# prLabels.push('gssoc'); | ||
# await github.issues.addLabels({ | ||
# owner: repoOwner, | ||
# repo: repoName, | ||
# issue_number: prNumber, | ||
# labels: prLabels.map(function(label) { | ||
# return label.name; | ||
# }) | ||
# }); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.