-
-
Notifications
You must be signed in to change notification settings - Fork 147
Modify optional workflows to be triggered by comments #977
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2e851e0
Modify optional workflows to be triggered by comments
loicdiridollou 732a842
Restore optional.yml
loicdiridollou 4eaf6f0
Restore optional.yml
loicdiridollou 3e9efc1
Merge branch 'main' of github.com:loicdiridollou/pandas-stubs into gh…
loicdiridollou 83763bd
GH613 Concentrate action in one with selector
loicdiridollou a484f2b
GH613 Adding documentation to tests.md and workflow file
loicdiridollou e959636
Fix typo in workflow file
loicdiridollou 1686d67
PR feedback
loicdiridollou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Comment Commands to Trigger CI | ||
on: | ||
issue_comment: | ||
types: created | ||
|
||
permissions: | ||
checks: write | ||
|
||
env: | ||
# store mapping of commands to use with poetry | ||
RUN_COMMAND: '{"/pandas_nightly": "pytest --nightly", "/pyright_strict": "pyright_strict", "/mypy_nightly": "mypy --mypy_nightly"}' | ||
# store mapping of labels to display in the check runs | ||
DISPLAY_COMMAND: '{"/pandas_nightly": "Pandas nightly tests", "/pyright_strict": "Pyright strict tests", "/mypy_nightly": "Mypy nightly tests"}' | ||
|
||
jobs: | ||
optional_tests: | ||
name: "Optional tests run" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
# if more commands are added, they will need to be added here too as we don't have avvecc to env at this stage | ||
if: (github.event.issue.pull_request) && contains(fromJSON('["/pandas_nightly", "/pyright_strict", "/mypy_nightly"]'), github.event.comment.body) | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install project dependencies | ||
uses: ./.github/setup | ||
with: | ||
os: ubuntu-latest | ||
python-version: "3.11" | ||
|
||
- name: Run ${{ fromJSON(env.DISPLAY_COMMAND)[github.event.comment.body] }} | ||
# run the tests based on the value of the comment | ||
id: tests-step | ||
run: poetry run poe ${{ fromJSON(env.RUN_COMMAND)[github.event.comment.body] }} | ||
|
||
- name: Get head sha and store value | ||
# get the sha of the last commit to attach the results of the tests | ||
if: always() | ||
id: get-sha | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const pr = await github.rest.pulls.get({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: ${{ github.event.issue.number }} | ||
}) | ||
core.setOutput('sha', pr.data.head.sha) | ||
|
||
- name: Report results of the tests and publish | ||
# publish the results to a check run no matter the pass or fail | ||
if: always() | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.rest.checks.create({ | ||
name: '${{ fromJSON(env.DISPLAY_COMMAND)[github.event.comment.body] }}', | ||
head_sha: '${{ steps.get-sha.outputs.sha }}', | ||
status: 'completed', | ||
conclusion: '${{ steps.tests-step.outcome }}', | ||
output: { | ||
title: 'Run ${{ fromJSON(env.DISPLAY_COMMAND)[github.event.comment.body] }}', | ||
summary: 'Results: ${{ steps.tests-step.outcome }}', | ||
text: 'See the actions run at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}', | ||
}, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}) |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.