Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ jobs:
run: ${{ steps.download-actionlint.outputs.executable }} -color
shell: bash

update-pull-request:
name: Update pull request
needs: check-workflows
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' }}
uses: ./.github/workflows/update-pull-request.yml
with:
dependabot: true
secrets:
PULL_REQUEST_UPDATE_TOKEN: ${{ secrets.PULL_REQUEST_UPDATE_TOKEN }}

lint-build-test:
name: Build, lint, and test
needs: check-workflows
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/update-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ on:
issue_comment:
types:
- created
workflow_call:
secrets:
PULL_REQUEST_UPDATE_TOKEN:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly as token for actions/checkout@v4:

# Use PAT to ensure that the commit later can trigger status check
# workflows.
token: ${{ secrets.PULL_REQUEST_UPDATE_TOKEN }}

required: true
inputs:
dependabot:
type: boolean
required: false
default: false

jobs:
is-fork-pull-request:
Expand All @@ -24,9 +33,10 @@ jobs:
react-to-comment:
name: React to the comment
runs-on: ubuntu-latest
needs: is-fork-pull-request
needs:
- is-fork-pull-request
# Early exit if this is a fork, since later steps are skipped for forks.
if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' }}
if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' && inputs.dependabot == false }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -46,7 +56,8 @@ jobs:
prepare:
name: Prepare dependencies
runs-on: ubuntu-latest
needs: is-fork-pull-request
needs:
- is-fork-pull-request
# Early exit if this is a fork, since later steps are skipped for forks.
if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' }}
outputs:
Expand Down Expand Up @@ -203,10 +214,13 @@ jobs:
path: yarn.lock
key: cache-yarn-lock-${{ needs.prepare.outputs.COMMIT_SHA }}
fail-on-cache-miss: true
- name: Set commit prefix
if: ${{ inputs.dependabot == true }}
run: echo "COMMIT_PREFIX='[dependabot skip] '" >> "$GITHUB_ENV"
- name: Commit yarn.lock
run: |
git add yarn.lock
git commit -m "Deduplicate yarn.lock" || true
git commit -m "${COMMIT_PREFIX}Deduplicate yarn.lock" || true
- name: Restore LavaMoat policies
uses: actions/cache/restore@v4
with:
Expand All @@ -216,7 +230,7 @@ jobs:
- name: Commit LavaMoat policies
run: |
git add packages/snaps-execution-environments/lavamoat
git commit -m "Update LavaMoat policies" || true
git commit -m "${COMMIT_PREFIX}Update LavaMoat policies" || true
- name: Restore examples
uses: actions/cache/restore@v4
with:
Expand All @@ -226,6 +240,6 @@ jobs:
- name: Commit examples
run: |
git add packages/examples/packages
git commit -m "Update example snaps" || true
git commit -m "${COMMIT_PREFIX}Update example snaps" || true
- name: Push changes
run: git push
Loading