-
Notifications
You must be signed in to change notification settings - Fork 118
feat: auto-trigger code sample testing #1367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 9 commits
dc8dd57
601bea4
e66f118
e0b3896
09189e3
80c5e4d
13b6d3e
f5121c0
9beccea
0c798ae
68bc6d5
b52772f
25008d7
cccf9bb
72fce84
c6875c4
984161c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Test API Docs Code Samples | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'apify-api/openapi/code_samples/**' | ||
pull_request: | ||
paths: | ||
- 'apify-api/openapi/code_samples/**' | ||
|
||
jobs: | ||
run-code-sample-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get current branch name | ||
id: get-branch-name | ||
m-murasovs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run: echo "branch_name=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Call Code Sample Tester Actor | ||
m-murasovs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
env: | ||
APIFY_TOKEN: ${{ secrets.CODE_SAMPLE_TESTER_ACTOR_TOKEN }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need to add a token for this once the actor is moved to the Apify account |
||
BRANCH_NAME: ${{ env.branch_name }} | ||
run: | | ||
curl --fail-with-body -X POST "https://api.apify.com/v2/acts/X8D0L4wfpO8fCL1uL/run-sync" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $APIFY_TOKEN" \ | ||
-d '{ "branch": "'"$BRANCH_NAME"'" }' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this work on PRs from forks? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great catch! I've modified the action and the actor so that the owner of the triggering repo is passed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's the last run with the test: https://console.apify.com/actors/X8D0L4wfpO8fCL1uL/runs/g4B6nhuQZVKlOc9dx#log There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, sorry I deleted that comment because I realised it was wrong, but hadn't seen your second one yet :) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sample is added so that the workflow gets triggered - it's also added in another PR |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ApifyClient } from 'apify-client'; | ||
|
||
const apifyClient = new ApifyClient({ | ||
token: '<TOKEN>', | ||
}); | ||
const updatedRun = await apifyClient | ||
.run('<RUN ID>') | ||
.update({ | ||
statusMessage: 'Actor has finished', | ||
}); | ||
|
||
console.log(updatedRun); |
Uh oh!
There was an error while loading. Please reload this page.