Skip to content

Support passing React.ReactElements for icons #116

Support passing React.ReactElements for icons

Support passing React.ReactElements for icons #116

name: Recommend integration tests
on:
pull_request:
jobs:
recommend:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Get source files changes
id: source-files
run: |
DIFF=$(git diff --name-only origin/main | grep 'packages/react' | grep -Ev '.stories.tsx|.docs.json' || true)
if [ -z "$DIFF" ]; then
echo "diff=" >> $GITHUB_OUTPUT
else
echo "diff=true" >> $GITHUB_OUTPUT
fi
- name: Has diff?
run: echo ${{ steps.source-files.outputs.diff != '' }}
- name: Get or Create Comment
if: ${{ steps.source-files.outputs.diff != '' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const result = await github.paginate(github.rest.issues.listComments, {
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
const previousComment = result.filter(c => c.user.login == 'github-actions[bot]' && c.body.startsWith('<!-- recommend-integration-tests.yml -->'))
if (!previousComment.length) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '<!-- recommend-integration-tests.yml -->\n\n :wave: Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the [integration workflow](https://gh.io/testing_primer_at_dotcom). Thanks!'
})
}
- name: Add label
if: ${{ steps.source-files.outputs.diff != '' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const result = await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
})
const integrationLabels = result.data.filter(label => label.name.startsWith('integration-tests'))
if (!integrationLabels.length) {
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['integration-tests: recommended'],
})
}