name: Development run # Requires mocking the "public" event to begin this workflow and avoid actual runs # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows on: public: jobs: run: runs-on: ubuntu-latest permissions: contents: read steps: - name: Checkout action uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Setup the Node runtime for this project uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: cache: npm cache-dependency-path: package-lock.json node-version-file: .nvmrc - name: Install dependencies run: npm install - name: Package the build run: npm run build - name: Start a workflow with a webhook trigger id: wfb uses: ./ with: errors: true webhook: ${{ secrets.SLACK_WEBHOOK_TRIGGER }} webhook-type: webhook-trigger payload: | author: ${{ github.event.sender.login }} channel_id: ${{ secrets.SLACK_CHANNEL_ID }} event_url: ${{ github.event.pull_request.html_url }} repo_name: ${{ github.event.repository.full_name }} status: ${{ job.status }} - name: Post a token message into channel id: api uses: ./ with: errors: true method: chat.postMessage token: ${{ secrets.SLACK_BOT_TOKEN }} payload: | channel: ${{ secrets.SLACK_CHANNEL_ID }} text: ":checkered_flag: Action happens at " - name: Initiate the deployment sequence id: slack uses: ./ with: errors: true method: chat.postMessage token: ${{ secrets.SLACK_BOT_TOKEN }} payload: | channel: ${{ secrets.SLACK_CHANNEL_ID }} text: ":eyes: Testing started..." attachments: - color: "dbab09" fields: - title: "Status" short: true value: "In Progress" - name: Write starting statistics id: stats uses: ./ with: errors: true method: chat.postMessage token: ${{ secrets.SLACK_BOT_TOKEN }} payload: | channel: ${{ steps.slack.outputs.channel_id }} text: "Started at `${{ steps.slack.outputs.time }}`" thread_ts: "${{ steps.slack.outputs.ts }}" - name: Countdown run: sleep 3 - name: Launch time is now id: finished uses: ./ with: errors: true method: chat.update token: ${{ secrets.SLACK_BOT_TOKEN }} payload: | channel: ${{ secrets.SLACK_CHANNEL_ID }} ts: "${{ steps.slack.outputs.ts }}" text: ":microscope: Testing finished!" attachments: - color: "28a745" fields: - title: "Status" short: true value: "Completed" - name: Include ending statistics uses: ./ with: errors: true method: chat.postMessage token: ${{ secrets.SLACK_BOT_TOKEN }} payload: | channel: ${{ steps.slack.outputs.channel_id }} text: "Finished at `${{ steps.finished.outputs.time }}`" thread_ts: "${{ steps.stats.outputs.thread_ts }}" - name: Celebrate wins uses: ./ with: errors: true method: reactions.add token: ${{ secrets.SLACK_BOT_TOKEN }} payload: | channel: ${{ secrets.SLACK_CHANNEL_ID }} timestamp: ${{ steps.slack.outputs.ts }} name: "eye-in-speech-bubble" - name: Upload this workflow file id: file uses: ./ with: errors: true method: files.uploadV2 token: ${{ secrets.SLACK_BOT_TOKEN }} payload: | channel_id: ${{ secrets.SLACK_CHANNEL_ID }} initial_comment: ":robot_face: The codes exists here" file: .github/workflows/develop.yml filename: action.yml - name: Write one final webhook uses: ./ with: errors: true webhook: ${{ secrets.SLACK_INCOMING_WEBHOOK }} webhook-type: incoming-webhook payload: | text: "end."