Skip to content

feat(workflows): revamp workflows with artifacts instead of a site #1

feat(workflows): revamp workflows with artifacts instead of a site

feat(workflows): revamp workflows with artifacts instead of a site #1

Workflow file for this run

# Adapted from https://nicolasiensen.github.io/2022-07-23-automating-dependency-updates-with-dependabot-github-auto-merge-and-github-actions/

Check failure on line 1 in .github/workflows/pr.automerge.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/pr.automerge.yml

Invalid workflow file

No steps defined in `steps` and no workflow called in `uses` for the following jobs: sanity
name: Dependabot Reviewer
on: pull_request_target
# on: workflow_dispatch
env:
MASTER_REF: master
permissions:
pull-requests: write
contents: write
jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: Sanity Check
run: |
echo "## Debug" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- ref: ${{ github.ref }}" >> $GITHUB_STEP_SUMMARY
echo "- user.login: ${{ github.event.pull_request.user.login }}" >> $GITHUB_STEP_SUMMARY
echo "- merged: ${{ github.event.pull_request.merged }}" >> $GITHUB_STEP_SUMMARY
echo "- merged_at: ${{ github.event.pull_request.merged_at }}" >> $GITHUB_STEP_SUMMARY
echo "- mergeable: ${{ github.event.pull_request.mergeable }}" >> $GITHUB_STEP_SUMMARY
echo "- mergeable_state: ${{ github.event.pull_request.mergeable_state }}" >> $GITHUB_STEP_SUMMARY
sanity:
if: github.event.pull_request.user.login == 'dependabot[bot]'
build:
needs: sanity
uses: ./.github/workflows/build.yml
diff:
name: Diff Builds
needs: build
runs-on: ubuntu-latest
steps:
- name: Sanity Check
run: |
echo "cwd: $(pwd)" && echo "Workspace: $GITHUB_WORKSPACE" && ls -Al $GITHUB_WORKSPACE
echo "diff: $(which diff)"
- name: Download Master Site
uses: actions/download-artifact@v4
with:
name: site-${{ env.MASTER_REF }}
path: master/
- name: Download PR Site
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact }}
path: pr/
- name: Diff Folders
id: diff
continue-on-error: true
run: diff --unified --recursive master/ pr/ >.diff
- name: Diff Found
if: steps.diff.outcome != 'success'
run: |
echo '## Diff Output' >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
cat .diff >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
exit 1
test:
needs: sanity
uses: ./.github/workflows/test.yml
review-dependabot-pr:
runs-on: ubuntu-latest
needs: [build, diff, test]
# if: github.event.pull_request.user.login == 'dependabot[bot]' && github.event.pull_request.mergeable == true
steps:
- name: Get Dependabot Metadata
id: dependabot-metadata
uses: dependabot/[email protected]
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Approve Mergable PRs
run: gh pr review $PR_URL --approve -b "This pull request is **automatically approved** because it is mergable."
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - name: Approve patch and minor updates
# if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
# run: gh pr review $PR_URL --approve -b "This pull request is **automatically approved** because it includes a **patch or minor update**."
# env:
# PR_URL: ${{github.event.pull_request.html_url}}
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - name: Approve major updates of development dependencies
# if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:development'}}
# run: gh pr review $PR_URL --approve -b "This pull request is **automatically approved** because it includes a **major update of a dependency used only in development**."
# env:
# PR_URL: ${{github.event.pull_request.html_url}}
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - name: Comment on major updates of non-development dependencies
# if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:production'}}
# run: |
# gh pr comment $PR_URL --body "This pull request is ***not* automatically approved** because it includes a **major update of a dependency used in production**."
# gh pr edit $PR_URL --add-label "requires-manual-qa"
# env:
# PR_URL: ${{github.event.pull_request.html_url}}
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}