-
Notifications
You must be signed in to change notification settings - Fork 14.3k
workflows: Unsplit new-prs #69560
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
Merged
Merged
workflows: Unsplit new-prs #69560
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
47bb041
workflows: Unsplit new-prs
tstellar 7af7d12
Add toplevel permissions
tstellar 5528158
Move all permissions to top-level
tstellar de43b1f
Revert "Move all permissions to top-level"
tstellar 6e5ad07
Remove redudant permission
tstellar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,56 +1,36 @@ | ||
name: "Labelling new pull requests" | ||
|
||
permissions: | ||
contents: read | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["PR Receive"] | ||
# It's safe to use pull_request_target here, because we aren't checking out | ||
# code from the pull request branch. | ||
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | ||
pull_request_target: | ||
types: | ||
- opened | ||
- reopened | ||
- ready_for_review | ||
- synchronize | ||
|
||
jobs: | ||
automate-prs-labels: | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
# Ignore PRs with more than 10 commits. Pull requests with a lot of | ||
# commits tend to be accidents usually when someone made a mistake while trying | ||
# to rebase. We want to ignore these pull requests to avoid excessive | ||
# notifications. | ||
if: > | ||
github.repository == 'llvm/llvm-project' && | ||
github.event.workflow_run.event == 'pull_request_target' && | ||
github.event.workflow_run.conclusion == 'success' | ||
github.event.pull_request.draft == false && | ||
github.event.pull_request.commits < 10 | ||
steps: | ||
# From: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | ||
# Updated version here: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow | ||
- name: Debug | ||
run: | | ||
echo "Event: ${{ github.event.workflow_run.event }} Conclusion: ${{ github.event.workflow_run.conclusion }}" | ||
- name: 'Download artifact' | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.payload.workflow_run.id | ||
}); | ||
const matchArtifact = artifacts.data.artifacts.find((artifact) => | ||
artifact.name === 'pr' | ||
); | ||
const download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip' | ||
}); | ||
const { writeFileSync } = require('node:fs'); | ||
writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data)); | ||
|
||
- run: unzip pr.zip | ||
|
||
- name: "Get PR Number" | ||
id: vars | ||
run: | ||
echo "pr-number=$(cat NR)" >> "$GITHUB_OUTPUT" | ||
|
||
- uses: actions/labeler@v4 | ||
with: | ||
configuration-path: .github/new-prs-labeler.yml | ||
# workaround for https://github.com/actions/labeler/issues/112 | ||
sync-labels: '' | ||
repo-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }} | ||
pr-number: ${{ steps.vars.outputs.pr-number }} |
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.