Skip to content

Commit 7c5b52d

Browse files
authored
ci: fixed duplicate action on dependabot auto-commit (#21)
* ci: fixed duplicate action on dependabot auto-commit * ci: fixed auto-merge not triggering action
1 parent 80fdfa0 commit 7c5b52d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,25 @@ jobs:
2222
name: Check requirements
2323
runs-on: ubuntu-latest
2424
outputs:
25-
run: ${{ github.event_name != 'push' && !contains(github.event.head_commit.message, '[skip dependabot]') }}
25+
run: ${{ github.event_name != 'push' && steps.skip.outputs.result != 'true' }}
2626
release: ${{ (steps.check_version_bump.outputs.release_type != '' && github.event_name == 'push') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true') }}
2727

2828
steps:
29+
- name: Checkout repository
30+
if: github.event.pull_request.head.sha != ''
31+
uses: actions/checkout@v3
32+
with:
33+
ref: ${{ github.event.pull_request.head.sha }}
34+
35+
- name: Check dependabot skip commit
36+
if: github.event.pull_request.head.sha != ''
37+
id: skip
38+
uses: actions/github-script@v6
39+
with:
40+
script: |
41+
const {stdout} = await exec.getExecOutput('git', ['show', '-s', '--format=%s']);
42+
return stdout.includes('[skip dependabot]');
43+
2944
- name: Check version bump
3045
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')
3146
id: check_version_bump
@@ -408,7 +423,7 @@ jobs:
408423
- name: Auto-merge
409424
run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}"
410425
env:
411-
GITHUB_TOKEN: ${{ github.token }}
426+
GITHUB_TOKEN: ${{ secrets.COMMIT_TOKEN }}
412427

413428
cd:
414429
name: Create release

0 commit comments

Comments
 (0)