chore: turn off dependabot (#417)

Luke Karrys committed Jan 13, 2023 at 15:47 UTC f57dcfbba6cc82f41a0cdb5b04c3832e0cda1e3c
3 files changed +8 -163
.github/dependabot.yml deleted
-41
@@ -1,41 +0,0 @@
1 -# This file is automatically added by @npmcli/template-oss. Do not edit.
2 -
3 -version: 2
4 -
5 -updates:
6 - - package-ecosystem: npm
7 - directory: /
8 - schedule:
9 - interval: daily
10 - allow:
11 - - dependency-type: direct
12 - versioning-strategy: increase-if-necessary
13 - commit-message:
14 - prefix: deps
15 - prefix-development: chore
16 - labels:
17 - - "Dependencies"
18 - - package-ecosystem: npm
19 - directory: cli/
20 - schedule:
21 - interval: daily
22 - allow:
23 - - dependency-type: direct
24 - versioning-strategy: increase-if-necessary
25 - commit-message:
26 - prefix: deps
27 - prefix-development: chore
28 - labels:
29 - - "Dependencies"
30 - - package-ecosystem: npm
31 - directory: theme/
32 - schedule:
33 - interval: daily
34 - allow:
35 - - dependency-type: direct
36 - versioning-strategy: increase-if-necessary
37 - commit-message:
38 - prefix: deps
39 - prefix-development: chore
40 - labels:
41 - - "Dependencies"
.github/workflows/post-dependabot.yml deleted
-122
@@ -1,122 +0,0 @@
1 -# This file is automatically added by @npmcli/template-oss. Do not edit.
2 -
3 -name: Post Dependabot
4 -
5 -on: pull_request
6 -
7 -permissions:
8 - contents: write
9 -
10 -jobs:
11 - template-oss:
12 - name: template-oss
13 - if: github.repository_owner == 'npm' && github.actor == 'dependabot[bot]'
14 - runs-on: ubuntu-latest
15 - defaults:
16 - run:
17 - shell: bash
18 - steps:
19 - - name: Checkout
20 - uses: actions/checkout@v3
21 - with:
22 - ref: ${{ github.event.pull_request.head.ref }}
23 - - name: Setup Git User
24 - run: |
25 - git config --global user.email "npm-cli+bot@github.com"
26 - git config --global user.name "npm CLI robot"
27 - - name: Setup Node
28 - uses: actions/setup-node@v3
29 - with:
30 - node-version: 18.x
31 - cache: npm
32 - - name: Install npm@latest
33 - run: npm i --prefer-online --no-fund --no-audit -g npm@latest
34 - - name: npm Version
35 - run: npm -v
36 - - name: Install Dependencies
37 - run: npm i --no-audit --no-fund
38 - - name: Fetch Dependabot Metadata
39 - id: metadata
40 - uses: dependabot/fetch-metadata@v1
41 - with:
42 - github-token: ${{ secrets.GITHUB_TOKEN }}
43 -
44 - # Dependabot can update multiple directories so we output which directory
45 - # it is acting on so we can run the command for the correct root or workspace
46 - - name: Get Dependabot Directory
47 - if: contains(steps.metadata.outputs.dependency-names, '@npmcli/template-oss')
48 - id: flags
49 - run: |
50 - dependabot_dir="${{ steps.metadata.outputs.directory }}"
51 - if [[ "$dependabot_dir" == "/" ]]; then
52 - echo "::set-output name=workspace::-iwr"
53 - else
54 - # strip leading slash from directory so it works as a
55 - # a path to the workspace flag
56 - echo "::set-output name=workspace::-w ${dependabot_dir#/}"
57 - fi
58 -
59 - - name: Apply Changes
60 - if: steps.flags.outputs.workspace
61 - id: apply
62 - run: |
63 - npm run template-oss-apply ${{ steps.flags.outputs.workspace }}
64 - if [[ `git status --porcelain` ]]; then
65 - echo "::set-output name=changes::true"
66 - fi
67 - # This only sets the conventional commit prefix. This workflow can't reliably determine
68 - # what the breaking change is though. If a BREAKING CHANGE message is required then
69 - # this PR check will fail and the commit will be amended with stafftools
70 - if [[ "${{ steps.metadata.outputs.update-type }}" == "version-update:semver-major" ]]; then
71 - prefix='feat!'
72 - else
73 - prefix='chore'
74 - fi
75 - echo "::set-output name=message::$prefix: postinstall for dependabot template-oss PR"
76 -
77 - # This step will fail if template-oss has made any workflow updates. It is impossible
78 - # for a workflow to update other workflows. In the case it does fail, we continue
79 - # and then try to apply only a portion of the changes in the next step
80 - - name: Push All Changes
81 - if: steps.apply.outputs.changes
82 - id: push
83 - continue-on-error: true
84 - env:
85 - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86 - run: |
87 - git commit -am "${{ steps.apply.outputs.message }}"
88 - git push
89 -
90 - # If the previous step failed, then reset the commit and remove any workflow changes
91 - # and attempt to commit and push again. This is helpful because we will have a commit
92 - # with the correct prefix that we can then --amend with @npmcli/stafftools later.
93 - - name: Push All Changes Except Workflows
94 - if: steps.apply.outputs.changes && steps.push.outcome == 'failure'
95 - env:
96 - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97 - run: |
98 - git reset HEAD~
99 - git checkout HEAD -- .github/workflows/
100 - git clean -fd .github/workflows/
101 - git commit -am "${{ steps.apply.outputs.message }}"
102 - git push
103 -
104 - # Check if all the necessary template-oss changes were applied. Since we continued
105 - # on errors in one of the previous steps, this check will fail if our follow up
106 - # only applied a portion of the changes and we need to followup manually.
107 - #
108 - # Note that this used to run `lint` and `postlint` but that will fail this action
109 - # if we've also shipped any linting changes separate from template-oss. We do
110 - # linting in another action, so we want to fail this one only if there are
111 - # template-oss changes that could not be applied.
112 - - name: Check Changes
113 - if: steps.apply.outputs.changes
114 - run: |
115 - npm exec --offline ${{ steps.flags.outputs.workspace }} -- template-oss-check
116 -
117 - - name: Fail on Breaking Change
118 - if: steps.apply.outputs.changes && startsWith(steps.apply.outputs.message, 'feat!')
119 - run: |
120 - echo "This PR has a breaking change. Run 'npx -p @npmcli/stafftools gh template-oss-fix'"
121 - echo "for more information on how to fix this with a BREAKING CHANGE footer."
122 - exit 1
scripts/template-oss/index.js
+8
@@ -6,6 +6,8 @@ module.exports = {
6 '.github/CODEOWNERS': 'CODEOWNERS',
7 '.github/ISSUE_TEMPLATE/bug.yml': false,
8 '.commitlintrc.js': false,
9 + '.github/dependabot.yml': false,
10 + '.github/workflows/post-dependabot.yml': false,
11 },
12 },
13 rootModule: {
@@ -13,6 +15,12 @@ module.exports = {
15 'CODE_OF_CONDUCT.md': false,
16 },
17 },
18 + workspaceRepo: {
19 + add: {
20 + '.github/dependabot.yml': false,
21 + '.github/workflows/post-dependabot.yml': false,
22 + },
23 + },
24 ciVersions: 'latest',
25 macCI: false,
26 windowsCI: false,