feat: add retry options for events api (#40) #111
This file contains 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
--- | |
name: CI | |
on: | |
pull_request: | |
branches: [master] | |
types: [opened, synchronize, reopened] | |
push: | |
branches: [master] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pytest: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install --upgrade -r requirements.txt | |
python -m pip install --upgrade -r requirements-dev.txt | |
- name: Test with pytest | |
id: test | |
env: | |
INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash | |
run: | | |
python -m pytest \ | |
-rxXs \ | |
--tb=native \ | |
--verbose \ | |
--cov=action \ | |
tests | |
- name: Upload coverage | |
# any except cancelled or skipped | |
if: >- | |
always() && | |
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') | |
uses: codecov/codecov-action@v3 | |
action: | |
strategy: | |
fail-fast: false | |
matrix: | |
set: | |
- '0' | |
- '1' | |
- '2' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run Action | |
id: action | |
uses: ./ | |
with: | |
changelog_path: ./tests/data/set${{ matrix.set }}/CHANGELOG.md | |
fail_on_events_api_error: # PRs will fail if this is true | |
${{ github.event_name == 'pull_request' && 'false' || 'true' }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Print action outputs | |
shell: bash | |
run: | | |
echo "changelog_exists: ${{ steps.action.outputs.changelog_exists }}" | |
echo "changelog_changes: ${{ steps.action.outputs.changelog_changes }}" | |
echo "changelog_date: ${{ steps.action.outputs.changelog_date }}" | |
echo "changelog_url: ${{ steps.action.outputs.changelog_url }}" | |
echo "changelog_version: ${{ steps.action.outputs.changelog_version }}" | |
echo "changelog_release_exists: ${{ steps.action.outputs.changelog_release_exists }}" | |
echo "publish_stable_release: ${{ steps.action.outputs.publish_stable_release }}" | |
echo "release_version: ${{ steps.action.outputs.release_version }}" | |
echo "release_tag: ${{ steps.action.outputs.release_tag }}" | |
- name: Verify changelog_exists | |
shell: bash | |
run: | | |
if [[ "${{ steps.action.outputs.changelog_exists }}" != "True" ]]; then | |
if [[ "${{ matrix.set }}" != "0" ]]; then | |
echo "changelog_exists is not true" | |
exit 1 | |
fi | |
fi | |
- name: Verify changelog_changes | |
shell: bash | |
run: | | |
expected_changes=$(cat ./tests/data/set${{ matrix.set }}/changes.txt) | |
if [[ "${{ steps.action.outputs.changelog_changes }}" != "${expected_changes}" ]]; then | |
echo "changelog_changes does not match expected" | |
exit 1 | |
fi | |
- name: Verify changelog_date | |
shell: bash | |
run: | | |
expected_date=$(cat ./tests/data/set${{ matrix.set }}/date.txt) | |
if [[ "${{ steps.action.outputs.changelog_date }}" != "${expected_date}" ]]; then | |
echo "changelog_date does not match expected" | |
exit 1 | |
fi | |
- name: Verify changelog_url | |
shell: bash | |
run: | | |
expected_url=$(cat ./tests/data/set${{ matrix.set }}/url.txt) | |
if [[ "${{ steps.action.outputs.changelog_url }}" != "${expected_url}" ]]; then | |
echo "changelog_url does not match expected" | |
exit 1 | |
fi | |
- name: Verify changelog_version | |
shell: bash | |
run: | | |
expected_version=$(cat ./tests/data/set${{ matrix.set }}/version.txt) | |
if [[ "${{ steps.action.outputs.changelog_version }}" != "${expected_version}" ]]; then | |
echo "changelog_version does not match expected" | |
exit 1 | |
fi | |
release: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
needs: | |
- pytest | |
- action | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run Action | |
id: setup-release | |
uses: ./ | |
with: | |
fail_on_events_api_error: true | |
github_token: ${{ secrets.GH_BOT_TOKEN }} | |
- name: Create Release | |
id: action | |
uses: LizardByte/create-release-action@master # keep this on master, to prevent endless depandabot PRs | |
with: | |
allowUpdates: false | |
artifacts: '' | |
body: '' | |
discussionCategory: announcements | |
generateReleaseNotes: true | |
name: ${{ steps.setup-release.outputs.release_tag }} | |
prerelease: ${{ steps.setup-release.outputs.publish_stable_release != 'true' }} | |
tag: ${{ steps.setup-release.outputs.release_tag }} | |
token: ${{ secrets.GH_BOT_TOKEN }} |