Skip to content

Commit 8ddb489

Browse files
authored
chore(ci): run tech debt burndown on forks (stenciljs#3552)
this commit changes the event type on the tech debt burndown list. the pull_request event does not offer the ability run the 'peter-evans/create-or-update-comment' step (see https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#restrictions-on-repository-forks) for security reasons. in this commit, we use 'pull_request_target' in an attempt to fix that. however, this affects what branch is used from in ci from the branch that the pr was opened with (pull_request), to the `HEAD` of `main` (pull_request_target). as a result, `actions/checkout` steps must be modified in order to account for the difference in branch
1 parent db07c27 commit 8ddb489

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/tech-debt-burndown.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: Tech Debt Burndown
77
# progress on them to each PR.
88

99
on:
10-
pull_request:
10+
pull_request_target:
1111
branches:
1212
- '**'
1313

@@ -27,6 +27,11 @@ jobs:
2727

2828
- name: Checkout PR branch
2929
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
30+
with:
31+
# the pull_request_target event will consider the HEAD of `main` to be the SHA to use.
32+
# attempt to use the SHA associated with a pull request and fallback to HEAD of `main`
33+
ref: ${{ github.event_name == 'pull_request_target' && format('refs/pull/{0}/merge', github.event.number) || '' }}
34+
persist-credentials: false
3035
if: ${{ matrix.branch == 'pr' }}
3136

3237
- name: Get Core Dependencies
@@ -60,6 +65,11 @@ jobs:
6065

6166
- name: Checkout PR branch
6267
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
68+
with:
69+
# the pull_request_target event will consider the HEAD of `main` to be the SHA to use.
70+
# attempt to use the SHA associated with a pull request and fallback to HEAD of `main`
71+
ref: ${{ github.event_name == 'pull_request_target' && format('refs/pull/{0}/merge', github.event.number) || '' }}
72+
persist-credentials: false
6373
if: ${{ matrix.branch == 'pr' }}
6474

6575
- name: Install ts-prune
@@ -81,6 +91,11 @@ jobs:
8191
steps:
8292
- name: Checkout current branch
8393
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
94+
with:
95+
# the pull_request_target event will consider the HEAD of `main` to be the SHA to use.
96+
# attempt to use the SHA associated with a pull request and fallback to HEAD of `main`
97+
ref: ${{ github.event_name == 'pull_request_target' && format('refs/pull/{0}/merge', github.event.number) || '' }}
98+
persist-credentials: false
8499

85100
- name: Get Core Dependencies
86101
uses: ./.github/workflows/actions/get-core-dependencies

0 commit comments

Comments
 (0)