Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore(bot): fix git push to forks #6571

Closed
wants to merge 1 commit into from
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
3 changes: 2 additions & 1 deletion .github/workflows/generate-screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ jobs:
skip_ruby: true
install_playwright: true
turborepo-server-port: ${{ steps.toolchain.outputs.port }}
- uses: LedgerHQ/ledger-live/tools/actions/composites/update-snapshots-desktop@develop
- uses: LedgerHQ/ledger-live/tools/actions/composites/update-snapshots-desktop@chore/update-push-on-forks
id: update-snapshots
with:
os: ubuntu-latest
prNumber: ${{ inputs.number }}

report-start:
name: Report start
Expand Down
21 changes: 18 additions & 3 deletions tools/actions/composites/update-snapshots-desktop/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
os:
description: "name of the os (same as runs-on)"
required: true
prNumber:
description: "PR number"
required: true

runs:
using: "composite"
Expand Down Expand Up @@ -38,13 +41,25 @@ runs:
- name: Commit snapshots
if: steps.status.outputs.status != 0 || steps.status-windows.outputs.status != 0
run: |
git config branch.autoSetupMerge simple
git add ./apps/ledger-live-desktop/tests/specs &&
git commit -m "test(lld): update screenshots (${{ inputs.os }}) ${{ steps.changes.outputs.changes }} lld, test, screenshot" &&
git restore . &&
git pull --rebase &&
git push ||
echo ""
git pull --rebase
shell: bash
- name: Push to PR
continue-on-error: true
shell: bash
id: push
run: |
git push
- name: Push to remote ref
shell: bash
id: push-remote
if: steps.push.outcome == 'failure'
run: |
git push origin HEAD:refs/pull/${{ inputs.prNumber }}/merge ||
echo ""
- name: Upload playwright results [On Failure]
uses: actions/upload-artifact@v3
if: failure() && !cancelled()
Expand Down
80 changes: 0 additions & 80 deletions tools/github-bot/src/commands/full-suite.ts

This file was deleted.

14 changes: 9 additions & 5 deletions tools/github-bot/src/commands/generate-screenshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ export function generateScreenshots(app: Probot) {
const number = payload.check_run.pull_requests[0]?.number;
const login = payload.sender.login;

const res = await context.octokit.orgs.checkMembershipForUser({
org: "LedgerHQ",
username: login,
});
try {
const res = await context.octokit.orgs.checkMembershipForUser({
org: "LedgerHQ",
username: login,
});

if (res.status >= 300) return;
if (res.status >= 300) return;
} catch (error) {
return;
}

if (!number) return;

Expand Down
14 changes: 9 additions & 5 deletions tools/github-bot/src/commands/regen-doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,16 @@ export function regenDoc(app: Probot) {
const number = payload.check_run.pull_requests[0]?.number;
const login = payload.sender.login;

const res = await context.octokit.orgs.checkMembershipForUser({
org: "LedgerHQ",
username: login,
});
try {
const res = await context.octokit.orgs.checkMembershipForUser({
org: "LedgerHQ",
username: login,
});

if (res.status >= 300) return;
if (res.status >= 300) return;
} catch (error) {
return;
}

if (!number) return;

Expand Down
14 changes: 9 additions & 5 deletions tools/github-bot/src/commands/regen-pods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,16 @@ export function regenPods(app: Probot) {
const number = payload.check_run.pull_requests[0]?.number;
const login = payload.sender.login;

const res = await context.octokit.orgs.checkMembershipForUser({
org: "LedgerHQ",
username: login,
});
try {
const res = await context.octokit.orgs.checkMembershipForUser({
org: "LedgerHQ",
username: login,
});

if (res.status >= 300) return;
if (res.status >= 300) return;
} catch (error) {
return;
}

if (!number) return;

Expand Down
3 changes: 0 additions & 3 deletions tools/github-bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { upToDate } from "./features/upToDate";
import { orchestrator } from "./features/orchestrator";
import { lintCommits } from "./features/lintCommits";
import { generateScreenshots } from "./commands/generate-screenshots";
import { runDesktopTestSuite } from "./commands/full-suite";
import { regenPods } from "./commands/regen-pods";
import { regenDoc } from "./commands/regen-doc";
import { autoClose } from "./features/autoClose";
Expand All @@ -17,8 +16,6 @@ export default (app: Probot) => {
regenPods(app);
// /regen-doc command
regenDoc(app);
// /full-lld-tests
runDesktopTestSuite(app);

/* PR stuff */

Expand Down
Loading