Skip to content

Commit

Permalink
Fix main github action
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaubennassar authored and krlosMata committed May 24, 2023
1 parent 7a8d0c1 commit 45028df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 101 deletions.
81 changes: 2 additions & 79 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ on:
branches: [main, develop]
pull_request:
branches: [main, develop]
repository_dispatch:
types: [ok-to-test-command]

jobs:
trusted-build:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
lint-and-test:
runs-on: ubuntu-latest

strategy:
Expand All @@ -25,88 +22,14 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set int-bot SSH key
run: |
touch /tmp/ssh-key
echo "${{ secrets.INT_BOT_SSH_KEY }}" > /tmp/ssh-key
chmod 400 /tmp/ssh-key
eval "$(ssh-agent -s)"
ssh-add /tmp/ssh-key
- name: Checkout code
uses: actions/checkout@v2
- name: setup
run: |
eval "$(ssh-agent -s)"
ssh-add /tmp/ssh-key
npm install -g npm@latest
npm i
- name: linter
run: npm run lint
- name: test
run: npm run test
from-fork-build:
if:
github.event_name == 'repository_dispatch' &&
github.event.client_payload.slash_command.sha != '' &&
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set int-bot SSH key
run: |
touch /tmp/ssh-key
echo "${{ secrets.INT_BOT_SSH_KEY }}" > /tmp/ssh-key
chmod 400 /tmp/ssh-key
eval "$(ssh-agent -s)"
ssh-add /tmp/ssh-key
- name: Fork based /ok-to-test checkout
uses: actions/checkout@v2
with:
ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'
- name: setup
run: |
eval "$(ssh-agent -s)"
ssh-add /tmp/ssh-key
npm install -g npm@latest
npm i
- name: linter
run: npm run lint
- name: test
run: npm run test
# Update check run
- uses: actions/github-script@v5
id: update-check-run
if: ${{ always() }}
env:
number: ${{ github.event.client_payload.pull_request.number }}
job: ${{ github.job }}
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
conclusion: ${{ job.status }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pull } = await github.rest.pulls.get({
...context.repo,
pull_number: process.env.number
});
const ref = pull.head.sha;
const { data: checks } = await github.rest.checks.listForRef({
...context.repo,
ref
});
const check = checks.check_runs.filter(c => c.name === process.env.job);
const { data: result } = await github.rest.checks.update({
...context.repo,
check_run_id: check[0].id,
status: 'completed',
conclusion: process.env.conclusion
});
return result;

22 changes: 0 additions & 22 deletions .github/workflows/ok-to-test.yml

This file was deleted.

0 comments on commit 45028df

Please sign in to comment.