Skip to content

Latest commit

 

History

History
87 lines (66 loc) · 2.48 KB

File metadata and controls

87 lines (66 loc) · 2.48 KB

notify-teams-deployment

Development

After making changes to index.mjs, run

pnpm build

to compile the script and its dependencies into a single file and a sourcemap file. Make sure to commit both files.

To learn more, see Javascript actions.

Permissions

  • The action needs actions: read permission in order to call listJobsForWorkflowRunAttempt.
  • The action needs pull-requests: read permission in order to call listPullRequestsAssociatedWithCommit.

Usage

The action can either be run as a step in a deploy job or as a separate job running after the deploy job.

As a step in a deploy job

If running as a step in a deploy job, result should be set to the value of job.status from the job context, which contains the current status of the job (Possible values are success, failure, or cancelled):

steps:
  # ... (deploy steps) ...

  - if: failure() || success()
    uses: biblioteksentralen/github-actions/notify-teams-deployment@main
    with:
      title: Libry Content
      webhooks-url: "${{ secrets.MS_TEAMS_WEBHOOK_URI_DEPLOY_CHANNEL }}"
      github-token: "${{ secrets.GITHUB_TOKEN }}"
      result: "${{ job.status }}"

Make sure that the job has at least the following permissions:

permissions:
  contents: read
  actions: read
  pull-requests: read

As a separate job

If running as a separate job, result should be set to the value of needs.<job_id>.result from the needs context, where <job_id> is the id of the deploy job (Possible values are success, failure, cancelled or skipped):

jobs:
  deploy:
    # ... (deploy steps) ...

  notify:
    # Run if previous job was successful or failed, but not if it was cancelled.
    if: success() || failure()
    name: Notify Teams
    runs-on: ubuntu-22.04
    permissions:
      contents: read
      actions: read
      pull-requests: read
    needs:
      - deploy
    steps:
      - uses: biblioteksentralen/github-actions/notify-teams-deployment@main
        with:
          title: Testy test
          webhooks-url: '${{ secrets.MS_TEAMS_WEBHOOK_URI}}'
          github-token: '${{ secrets.GITHUB_TOKEN }}'
          result: '${{ needs.deploy.result }}'

Inputs

See action.yml for more details.