Skip to content

Commit

Permalink
ci: fixed duplicate action on dependabot auto-commit (#21)
Browse files Browse the repository at this point in the history
* ci: fixed duplicate action on dependabot auto-commit

* ci: fixed auto-merge not triggering action
  • Loading branch information
soumyamahunt authored Aug 31, 2023
1 parent 80fdfa0 commit 7c5b52d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,25 @@ jobs:
name: Check requirements
runs-on: ubuntu-latest
outputs:
run: ${{ github.event_name != 'push' && !contains(github.event.head_commit.message, '[skip dependabot]') }}
run: ${{ github.event_name != 'push' && steps.skip.outputs.result != 'true' }}
release: ${{ (steps.check_version_bump.outputs.release_type != '' && github.event_name == 'push') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true') }}

steps:
- name: Checkout repository
if: github.event.pull_request.head.sha != ''
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Check dependabot skip commit
if: github.event.pull_request.head.sha != ''
id: skip
uses: actions/github-script@v6
with:
script: |
const {stdout} = await exec.getExecOutput('git', ['show', '-s', '--format=%s']);
return stdout.includes('[skip dependabot]');
- name: Check version bump
if: (github.event_name == 'push' && startsWith(github.event.head_commit.message, 'build(swift-org-website):')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true')
id: check_version_bump
Expand Down Expand Up @@ -408,7 +423,7 @@ jobs:
- name: Auto-merge
run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}"
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.COMMIT_TOKEN }}

cd:
name: Create release
Expand Down

0 comments on commit 7c5b52d

Please sign in to comment.