Skip to content
Closed
Show file tree
Hide file tree
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
44 changes: 41 additions & 3 deletions .github/workflows/on_new_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ on:
permissions:
contents: read

# NOTE: pull_request_target resolves local composite actions from the filesystem rather than git
# storage, and since the workspace is empty at job initialisation (before any steps run), local
# uses: ./.github/actions/... references will always fail — even with an actions/checkout step,
# because step execution happens after action path resolution. As a result, any steps in this
# workflow that would otherwise use local composite actions must inline their logic directly.

jobs:
enable-auto-merge:
runs-on: ubuntu-latest
Expand All @@ -29,10 +35,33 @@ jobs:
if: contains(github.event.pull_request.labels.*.name, 'dependencies')
steps:
- name: "Auto Merge"
uses: ./.github/actions/enable-automerge
uses: actions/github-script@v9.0.0
with:
github-token: ${{secrets.SOURCE_PUSH_TOKEN}}
merge-method: "MERGE"
script: |
const mergeMethod = process.env.MERGE_METHOD;
const nodeId = context.payload.pull_request.node_id;
await github.graphql(`
mutation EnableAutoMerge($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
enablePullRequestAutoMerge(input: {
pullRequestId: $pullRequestId,
mergeMethod: $mergeMethod
}) {
pullRequest {
autoMergeRequest {
mergeMethod
}
}
}
}
`, {
pullRequestId: nodeId,
mergeMethod: mergeMethod,
});
core.info(`✅ Enabled auto-merge (${mergeMethod}) on PR #${context.payload.pull_request.number}`);
core.notice(`Enabled auto-merge (${mergeMethod}) on PR #${context.payload.pull_request.number}`);
env:
MERGE_METHOD: "MERGE"

auto_approve_dependabot:
runs-on: ubuntu-latest
Expand All @@ -44,6 +73,15 @@ jobs:
if: contains(github.event.pull_request.labels.*.name, 'dependencies')
steps:
- name: "Auto Approve"
uses: ./.github/actions/approve-pr
uses: actions/github-script@v9.0.0
with:
github-token: ${{secrets.SOURCE_PUSH_TOKEN}}
script: |
await github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
event: 'APPROVE',
});
core.info(`✅ Approved PR #${context.payload.pull_request.number}`);
core.notice(`Approved PR #${context.payload.pull_request.number}`);
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release
- Replace raw echo with output helpers in git/mkmissing-release
- Replace raw echo with output helpers in git/init-preview
- Replace raw echo with output helpers in git/clone-repos
- Inline enable-auto-merge and auto-approve scripts in Pull Request workflow to fix pull_request_target local action resolution failure
### Changed
- Replace raw echo with standard output helpers (die/info/success) in github/cancel-workflows
- Replace raw echo with standard output helpers (die/info/success) in git/update-repos-personal
Expand Down
Loading