forked from hedyorg/hedy
-
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.
[CHORE] Make Update JavaScript action run in PR context (hedyorg#3689)
The event `pull_request_target` (as opposed to `pull_request`) makes it run in the context of `main`, instead of the context of the PR itself. This caused it to use files from `main` instead of the PR, incorrectly representing its success or failure. **How to test** On this PR: * We should be able to change a TS file and see the JS be regenerated and committed. After merging: * The same should happen for fork PRs. In case this action is broken for fork PRs, we should just add something like: ``` if: github.event.push ``` To the commit action, and forego committing on PRs altogether (just leave committing on main), but DO run the generator, so that we can see it if it fails.
- Loading branch information
Showing
3 changed files
with
8 additions
and
7 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 |
---|---|---|
|
@@ -5,7 +5,7 @@ name: Automatically update JavaScript bundle | |
on: | ||
push: | ||
branches: [ main ] | ||
pull_request_target: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
@@ -14,12 +14,14 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
# This is necessary to bypass branch protection (which will disallow non-reviewed pushes otherwise) | ||
token: ${{ secrets.FELIENNE_GITHUB_ACCESS_TOKEN }} | ||
|
||
# This is necessary to check out the | ||
- name: Install Nodejs dependencies | ||
run: | | ||
npm ci | ||
|
@@ -38,9 +40,10 @@ jobs: | |
|
||
- name: Commit changed files | ||
uses: stefanzweifel/[email protected] | ||
if: github.event_name == 'push' | ||
with: | ||
commit_message: Automatically update JavaScript bundle 🤖 beep boop | ||
branch: main | ||
branch: ${{ github.head_ref }} | ||
env: | ||
# This is necessary to bypass branch protection (which will disallow non-reviewed pushes otherwise) | ||
GITHUB_TOKEN: ${{ secrets.FELIENNE_GITHUB_ACCESS_TOKEN }} |
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
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 |
---|---|---|
|
@@ -125,4 +125,4 @@ export class Markers { | |
interface MarkerLocation { | ||
readonly line: number; | ||
readonly id: number; | ||
} | ||
} |