diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index a72bad578..9846a5a90 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -51,7 +51,6 @@ jobs: env: # Secrets of all kinds for fetching stats & releases GITHUB_API_SECRET: ${{ secrets.GITHUB_TOKEN }} - ZAMMAD_API_SECRET_KEY: ${{ secrets.ZAMMAD_API_SECRET_KEY }} ATINTERNET_API_SECRET_KEY: ${{ secrets.ATINTERNET_API_SECRET_KEY }} ATINTERNET_API_ACCESS_KEY: ${{ secrets.ATINTERNET_API_ACCESS_KEY }} CRISP_API_IDENTIFIER: ${{ secrets.CRISP_API_IDENTIFIER }} @@ -108,7 +107,6 @@ jobs: env: # Secrets of all kinds for fetching stats & releases GITHUB_API_SECRET: ${{ secrets.GITHUB_TOKEN }} - ZAMMAD_API_SECRET_KEY: ${{ secrets.ZAMMAD_API_SECRET_KEY }} ATINTERNET_API_SECRET_KEY: ${{ secrets.ATINTERNET_API_SECRET_KEY }} ATINTERNET_API_ACCESS_KEY: ${{ secrets.ATINTERNET_API_ACCESS_KEY }} CRISP_API_IDENTIFIER: ${{ secrets.CRISP_API_IDENTIFIER }} diff --git a/.github/workflows/pr-cleanup.yaml b/.github/workflows/pr-cleanup.yaml index 6dc968886..746e8a1a2 100644 --- a/.github/workflows/pr-cleanup.yaml +++ b/.github/workflows/pr-cleanup.yaml @@ -21,7 +21,6 @@ jobs: env: # Secrets of all kinds for fetching stats & releases GITHUB_API_SECRET: ${{ secrets.GITHUB_TOKEN }} - ZAMMAD_API_SECRET_KEY: ${{ secrets.ZAMMAD_API_SECRET_KEY }} ATINTERNET_API_SECRET_KEY: ${{ secrets.ATINTERNET_API_SECRET_KEY }} ATINTERNET_API_ACCESS_KEY: ${{ secrets.ATINTERNET_API_ACCESS_KEY }} CRISP_API_IDENTIFIER: ${{ secrets.CRISP_API_IDENTIFIER }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d683c937a..60b72d7d9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,7 +17,6 @@ jobs: env: # Secrets of all kinds for fetching stats & releases GITHUB_API_SECRET: ${{ secrets.GITHUB_TOKEN }} - ZAMMAD_API_SECRET_KEY: ${{ secrets.ZAMMAD_API_SECRET_KEY }} ATINTERNET_API_SECRET_KEY: ${{ secrets.ATINTERNET_API_SECRET_KEY }} ATINTERNET_API_ACCESS_KEY: ${{ secrets.ATINTERNET_API_ACCESS_KEY }} CRISP_API_IDENTIFIER: ${{ secrets.CRISP_API_IDENTIFIER }} diff --git a/.github/workflows/update-stats.yaml b/.github/workflows/update-stats.yaml index e8b28c8eb..7d8c415ea 100644 --- a/.github/workflows/update-stats.yaml +++ b/.github/workflows/update-stats.yaml @@ -13,7 +13,6 @@ jobs: env: # Secrets of all kinds for fetching stats & releases GITHUB_API_SECRET: ${{ secrets.GITHUB_TOKEN }} - ZAMMAD_API_SECRET_KEY: ${{ secrets.ZAMMAD_API_SECRET_KEY }} ATINTERNET_API_SECRET_KEY: ${{ secrets.ATINTERNET_API_SECRET_KEY }} ATINTERNET_API_ACCESS_KEY: ${{ secrets.ATINTERNET_API_ACCESS_KEY }} CRISP_API_IDENTIFIER: ${{ secrets.CRISP_API_IDENTIFIER }} @@ -23,7 +22,6 @@ jobs: env: # Secrets of all kinds for fetching stats & releases GITHUB_API_SECRET: ${{ secrets.GITHUB_TOKEN }} - ZAMMAD_API_SECRET_KEY: ${{ secrets.ZAMMAD_API_SECRET_KEY }} ATINTERNET_API_SECRET_KEY: ${{ secrets.ATINTERNET_API_SECRET_KEY }} ATINTERNET_API_ACCESS_KEY: ${{ secrets.ATINTERNET_API_ACCESS_KEY }} CRISP_API_IDENTIFIER: ${{ secrets.CRISP_API_IDENTIFIER }} diff --git a/.github/workflows/zammad-bot.yaml b/.github/workflows/zammad-bot.yaml deleted file mode 100644 index 9618a7eea..000000000 --- a/.github/workflows/zammad-bot.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# This bot post a comment when issues with a given label are closed. -name: Message du robot Zammad -on: - issues: - types: [closed] - -jobs: - comment-when-issue-close: - if: contains(github.event.issue.labels.*.name, '🏓 retour utilisateur') - runs-on: ubuntu-latest - steps: - # Note: we could detect if the comment was already posted in the issue to - # avoid posting it multiple times in case the issue was re-opened and - # re-closed. https://github.com/peter-evans/create-or-update-comment - - uses: peter-evans/create-or-update-comment@v3 - with: - issue-number: ${{ github.event.issue.number }} - body: | - Ce ticket vient d'être fermé 🎉 - - Il est temps de prévenir les utilisateurs qui nous ont fait ce retour : - https://mon-entreprise.zammad.com/#search/tags%3A%23${{ github.event.issue.number }} - - Laissez un 👍 quand c'est fait ! diff --git a/site/.env.template b/site/.env.template index d69e19a75..1af702f0e 100644 --- a/site/.env.template +++ b/site/.env.template @@ -4,7 +4,6 @@ ALGOLIA_ADMIN_KEY= ATINTERNET_API_ACCESS_KEY= ATINTERNET_API_SECRET_KEY= DEEPL_API_SECRET= -ZAMMAD_API_SECRET_KEY= SENTRY_AUTH_TOKEN= # Utilisez votre propre token (voir issue en haut pour en créé un) diff --git a/site/netlify.base.toml b/site/netlify.base.toml index 72549d05f..81816c7c3 100644 --- a/site/netlify.base.toml +++ b/site/netlify.base.toml @@ -3,10 +3,10 @@ for = "/*" [headers.values] Content-Security-Policy = """\ default-src 'self' mon-entreprise.fr; \ - style-src 'self' 'unsafe-inline' mon-entreprise.zammad.com; \ - connect-src 'self' *.incubateur.net raw.githubusercontent.com tm.urssaf.fr mon-entreprise.zammad.com recherche-entreprises.api.gouv.fr api.recherche-entreprises.fabrique.social.gouv.fr geo.api.gouv.fr *.algolia.net *.algolianet.com polyfill.io jedonnemonavis.numerique.gouv.fr user-images.githubusercontent.com; \ - form-action 'self' *.sibforms.com *.incubateur.net mon-entreprise.zammad.com; \ - script-src 'self' 'unsafe-inline' 'unsafe-eval' tm.urssaf.fr *.incubateur.net stonly.com code.jquery.com mon-entreprise.zammad.com polyfill.io; \ + style-src 'self' 'unsafe-inline'; \ + connect-src 'self' *.incubateur.net raw.githubusercontent.com tm.urssaf.fr recherche-entreprises.api.gouv.fr api.recherche-entreprises.fabrique.social.gouv.fr geo.api.gouv.fr *.algolia.net *.algolianet.com polyfill.io jedonnemonavis.numerique.gouv.fr user-images.githubusercontent.com; \ + form-action 'self' *.sibforms.com *.incubateur.net; \ + script-src 'self' 'unsafe-inline' 'unsafe-eval' tm.urssaf.fr *.incubateur.net stonly.com code.jquery.com polyfill.io; \ img-src 'self' data: mon-entreprise.urssaf.fr tm.urssaf.fr user-images.githubusercontent.com github.com *.s3.amazonaws.com jedonnemonavis.numerique.gouv.fr; \ frame-src 'self' https://www.youtube-nocookie.com https://codesandbox.io https://place-des-entreprises.beta.gouv.fr https://reso-staging.osc-fr1.scalingo.io https://stackblitz.com https://conseillers-entreprises.service-public.fr \ """ diff --git a/site/scripts/stats/fetch-stats.js b/site/scripts/stats/fetch-stats.js index 4033924c2..4cae4e4be 100644 --- a/site/scripts/stats/fetch-stats.js +++ b/site/scripts/stats/fetch-stats.js @@ -368,25 +368,9 @@ async function fetchCrispAnsweredConversationsLastMonth() { return conversations?.length ?? 0 } -async function fetchZammadUserAnswersStats() { - const ticketLists = await fetch( - 'https://mon-entreprise.zammad.com/api/v1/ticket_overviews?view=tickets_repondus_le_mois_dernier', - { - headers: new Headers({ - Authorization: `Token token=${process.env.ZAMMAD_API_SECRET_KEY}`, - }), - } - ) - const answer = await ticketLists.json() - return answer.index.count -} - // eslint-disable-next-line no-unused-vars async function fetchAllUserAnswerStats() { - const zammadAnswersCount = await fetchZammadUserAnswersStats() - const cripsAnswersCount = await fetchCrispAnsweredConversationsLastMonth() - - return zammadAnswersCount + cripsAnswersCount + return await fetchCrispAnsweredConversationsLastMonth() } async function fetchGithubIssuesFromTags(tags) { @@ -456,34 +440,11 @@ async function fetchCrispUserFeedbackIssues() { return issueCount } -async function fetchZammadUserFeedbackIssues() { - const tags = await fetch( - 'https://mon-entreprise.zammad.com/api/v1/tag_list', - { - headers: new Headers({ - Authorization: `Token token=${process.env.ZAMMAD_API_SECRET_KEY}`, - }), - } - ).then((r) => r.json()) - - if (tags.error) { - console.error('Zammad error: ' + JSON.stringify(tags)) - } - - const issues = tags.filter(({ name }) => /#[\d]+/.exec(name)) - - return issues.reduce( - (acc, { name, count }) => ({ ...acc, [name]: count }), - {} - ) -} - // eslint-disable-next-line no-unused-vars async function fetchAllUserFeedbackIssues() { const crispFeedbackIssues = await fetchCrispUserFeedbackIssues() - const zammadFeedbackIssues = await fetchZammadUserFeedbackIssues() - const allIssues = [crispFeedbackIssues, zammadFeedbackIssues] + const allIssues = crispFeedbackIssues .flatMap((issues) => Object.entries(issues)) .reduce( (acc, [issue, count]) => ({ @@ -540,7 +501,6 @@ writeInDataDir('stats.json', baseData) if ( !process.env.ATINTERNET_API_ACCESS_KEY || !process.env.ATINTERNET_API_SECRET_KEY || - !process.env.ZAMMAD_API_SECRET_KEY || !process.env.CRISP_API_IDENTIFIER || !process.env.CRISP_API_KEY || !process.env.GITHUB_API_SECRET @@ -550,7 +510,6 @@ if ( `Variables d'environnement manquantes : ${[ missingEnvVar('ATINTERNET_API_ACCESS_KEY'), missingEnvVar('ATINTERNET_API_SECRET_KEY'), - missingEnvVar('ZAMMAD_API_SECRET_KEY'), missingEnvVar('CRISP_API_IDENTIFIER'), missingEnvVar('CRISP_API_KEY'), missingEnvVar('GITHUB_API_SECRET'),