Coder Social home page Coder Social logo

jamesives / fetch-api-data-action Goto Github PK

View Code? Open in Web Editor NEW
100.0 2.0 13.0 34.69 MB

🚚 GitHub action for handling authenticated API requests, allowing you to save the data from the request into your workspace as an environment variable and a .json file.

Home Page: https://github.com/marketplace/actions/fetch-api-data

License: MIT License

JavaScript 11.77% TypeScript 88.23%
github-actions github-action github-actions-typescript cicd api fetch workflow workflow-configuration hacktoberfest actions action continuous-delivery

fetch-api-data-action's Introduction

Fetch API Data Action 📦 🚚

This GitHub Action will handle authenticated API requests for you, allowing you to save the data from the request into your workspace as an environment variable and a file. Using this action will allow you to save data from these queries on a schedule so they can be used in a static page without exposing your API credentials. You can read more about the inspiration for this action here.

Maintenance of this project is made possible by all the contributors and sponsors. If you'd like to sponsor this project and have your avatar or company logo appear below click here. 💖

github  annegentle  

Chooksta69  MattWillFlood  milanpollock  raoulvdberge  robjtede  hadley  kevinchalet  Yousazoe  planetoftheweb  melton1968  szepeviktor  sckott  provinzkraut  electrovir  Griefed  

Getting Started ✈️

You can include the action in your workflow to trigger on any event that GitHub actions supports. You'll need to provide the action with the endpoint you'd like to request along with any configuration options as stringified JSON.

name: Refresh Feed
on: [push]
jobs:
  refresh-feed:
    runs-on: ubuntu-latest
    steps:
      - name: Fetch API Data 📦
        uses: JamesIves/fetch-api-data-action@v2
        with:
          endpoint: https://example.com
          configuration: '{ "method": "GET", "headers": {"Authorization": "Bearer ${{ secrets.API_TOKEN }}"} }'

Once the action has run the requested data will be exported into the fetch-api-data environment variable and will also be available as a .json file in your workspace located by default in the fetch-api-data-action/data.json directory. If you need something other than .json file please refer to the format parameter.

You can combine the use of this with the GitHub Pages Deploy Action to trigger scheduled updates to a feed on your website.

You can view a full example of this here.

In one workflow you can fetch data from an API on a schedule and push it to your main branch.

name: Refresh Feed
on:
  schedule:
    - cron: 10 15 * * 0-6
jobs:
  refresh-feed:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v2
        with:
          persist-credentials: false

      - name: Fetch API Data 📦
        uses: JamesIves/fetch-api-data-action@v2
        with:
          endpoint: https://example.com
          configuration: '{ "method": "GET", "headers": {"Authorization": "Bearer ${{ secrets.API_TOKEN }}"} }'

      - name: Build and Deploy 🚀
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          branch: main # Pushes the updates to the main branch.
          folder: fetch-api-data-action # The location of the data.json file saved by the Fetch API Data action.
          target-folder: data # Saves the data into the 'data' directory on the main branch.

In another workflow you can then build and deploy your page.

name: Build and Deploy
on:
  schedule:
    - cron: 10 16 * * 0-6
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v2
        with:
          persist-credentials: false

      - name: Install 🔧
        run: |
          npm install
          npm run-script build

      - name: Build and Deploy 🚀
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          branch: gh-pages
          folder: build

In your project you can import the JSON file and make it part of your build script. This way your site will re-build and deploy whenever refreshed data has been fetched from the server.

Install as a Node Module 📦

If you'd like to use the functionality provided by this action in your own action you can either create a composite action, or you can install it using yarn or npm by running the following commands. It's available on both the npm and GitHub registry.

yarn add @jamesives/fetch-api-data-action

It can then be imported into your project like so.

import run, {
  retrieveData,
  generateExport,
  ActionInterface
} from '@jamesives/fetch-api-data-action'

Calling the functions directly will require you to pass in an object containing the variables found in the configuration section.

import run from '@jamesives/fetch-api-data-action'

run({
  endpoint: 'https://example.com',
  configuration: JSON.stringify({
    method: 'GET',
    headers: {Authorization: `Bearer ${process.env['TOKEN']}`}
  })
})

Configuration 📁

The with portion of the workflow must be configured before the action will work. You can add these in the with section found in the examples above. Any secrets must be referenced using the bracket syntax and stored in the GitHub repositories Settings/Secrets menu. You can learn more about setting environment variables with GitHub actions here.

Minimal Setup

The following configuration options should be set.

Key Value Information Type Required
endpoint The URL of the endpoint you'd like to retrieve data from. For example: https://example.com/data. If no configuration is provided then the default request method will be GET. with Yes
configuration Any applicable configuration settings that should be set such as authentication tokens. You can reference secrets using the ${{ secrets.secret_name }} syntax, or you can reference data returned from the token-endpoint request using the triple bracket syntax: {{{ data.access_token }}}. For more information refer to the Token Request part of the readme and the Fetch API documentation. secrets / with No

Optional Choices

Key Value Information Type Required
token-endpoint If the endpoint API requires you to make a request to get an access token prior to fetching data you can perform this task by specifying a token endpoint. Any data returned from the token end can be referenced in the configuration variable using the triple bracket syntax: {{{ access_token }}}. For more information refer to the Token Request part of the readme; with No
token-configuration Any applicable configuration settings that should be set such as authentication tokens. You can reference secrets using the ${{ secrets.secret_name }} syntax. For more information refer to the Fetch API documentation. secrets / with No
retry If you're working with an intermittent API you can toggle this option to true. Doing so will make the action try the request 3 times at random intervals before failing. with No
save-location By default the save location of the file is fetch-api-data-action/data.json, if you'd like to override the directory you can do so by specifying a new one with this variable. with No
save-name You can override the name of the exported .json file by specifying a new one here. You should not include the file extension in your name.
variable-name Adjusts the name of the environment variable the action generates so long as set-output is true. Defaults to fetchApiData. with No
set-output Determines if the returned data should be saved as an environment variable or not. This field defaults to true, but depending on your API response length you may need to toggle this. If true, an environment variable and action step output named fetchApiData will be created. with No
format Allows you to modify the extension of the file saved from the API response, for example you can set this field to json or txt. This field defaults to json. with No
encoding Allows you to modify the encoding of the file saved from the API response, for example you can set this field to utf8 or hex. This field defaults to utf8. Choose from ascii, utf8, utf-8, utf16le, ucs2, ucs-2, base64, latin1, binary or hex. with No
debug If set to true the action will log the API responses it receives in the terminal. with No

Token Request 🎟️

If you need to make a request to another endpoint in order to request an access token or something similar you can do so using the token-endpoint and token-configuration parameters. You can then use the returned token in your configuration variable using the triple syntax like so {{{ tokens.access_token }}}. You can find an example of this below.

name: Refresh Feed
on: [push]
jobs:
  refresh-feed:
    runs-on: ubuntu-latest
    steps:
      - name: Fetch API Data 📦
        uses: JamesIves/fetch-api-data-action@v2
        with:
          # The token endpoint is requested first. This retrieves the access token for the other endpoint.
          token-endpoint: https://example.com/auth/token
          # The configuration contains secrets held in the Settings/Secrets menu of the repository.
          token-configuration: '{ "method": "POST", "body": {"client_id": "${{ secrets.client_id }}", "client_secret": "${{ secrets.client_secret }}"} }'
          # Once the token endpoint has fetched then this endpoint is requested.
          endpoint: https://example.com/data
          # The bearer token here is returned from the TOKEN_ENDPOINT call. The returned data looks like so: {data: {access_token: '123'}}, meaning it can be accessed using the triple bracket syntax.
          configuration: '{ "method": "GET", "headers": {"Authorization": "Bearer {{{ data.access_token }}}"} }'

fetch-api-data-action's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar humble-barnacle001 avatar jamesives avatar nickmccurdy avatar saravananselvamohan avatar sojinsamuel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fetch-api-data-action's Issues

Argument list too long

Describe the bug

I do send a huge message of 350.000 characters in the body.
So I get the next issue:

image

Reproduction Steps

send a huge message of 350.000 characters in the body.

Logs

image

Workflow

image

Bug File not found: '/home/runner/work/_actions/JamesIves/fetch-api-data-action/1.0.11/lib/main.js

First of all, thanks for this action @JamesIves.

Seems to be some files missing in your latest version if I compare the 1.0.9 version with this one, there is no lib folder provided

(1.0.9)
image

vs

(1.011)
image

And here's the error I am getting

image

And just in case, here's my action


name: Cron jobs

on:
  schedule:
    - cron: 0 8 * * *

jobs:
    clean:
    runs-on: ubuntu-latest
    steps:
      - name: Fetch API Data 📦
        uses: JamesIves/fetch-api-data-action@releases/v1
        with:
          ENDPOINT: https://myapi.com
          CONFIGURATION: '{ "method": "GET", "headers": {"Authorization": "${{ secrets.MY_SECRET }}"} }'


Maybe I am just doing something wrong. Hopefully this will help if this is a real issue.

Retry fetch option for intermittent API errors

Excellent github action! I'm using your action to cache an external API which is secured with OAuth.

This API often experiences issues: There was an error fetching from the API: FetchError: invalid json response body at https://example.com reason: Unexpected end of JSON input.

By retrying the same request in a few seconds the error will usually go away. I propose adding an option that allows failed requests to be retried N times waiting M seconds between requests.

Update Node from 10 to 12

Describe the bug

Right now the .nvmrc file points to Node 10. This is two versions out of date and should be updated to use the latest Node version.

Additional Comments

  • Change the node version, install with nvm use.
  • Run the usual commands, yarn install, yarn format, yarn lint, yarn test. Ensure there are no issues.
  • Make applicable readme and fixes to ensure it's clear to the user that this action runs on Node 12+.

Version 2

Describe the bug

I'd like to bring this action more in-line with my other actions and cut a version 2 release.

  • Change the input names so they match this-case instead of THIS_CASE.
  • Improve the documentation.
  • Add GitHub Discussions and align the issue/README templates.
  • Migrate ESLint configuration so they are the same.
  • Add workflow helpers
  • Add better integration tests.

If you use this action and have any suggestions for version 2, please let me know!

README

Write the actual README.

Argument list too long when fetching large JSON file

Describe the bug

I receive the error "Error: An error occurred trying to start process '/home/runner/runners/2.288.1/externals/node12/bin/node' with working directory '/home/runner/work/mtg-art-game/mtg-art-game'. Argument list too long" when fetching a large json catalog of card names.

Reproduction Steps

The workflow fires successfully with other API calls, but always fails with this one: https://api.scryfall.com/catalog/card-names

Logs

logs_32.zip

Workflow

name: Update Card Names Catalog
on:
  schedule:
    - cron: 0 0 * * SUN
     # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
jobs:
  update-cards:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v2
        with:
          persist-credentials: false

      - name: Fetch API Data
        uses: JamesIves/[email protected]
        with:
          endpoint: https://api.scryfall.com/catalog/card-names
          configuration: '{ "method": "GET" }'
          save-location: assets
          save-name: test

      - name: Deploy to GitHub Pages
        uses: JamesIves/[email protected]
        with:
          branch: main # Pushes the updates to the main branch.
          folder: assets # The location of the data.json file saved by the Fetch API Data action.
          target-folder: assets # Saves the data into the 'data' directory on the main branch.

Additional Comments

Is there a maximum JSON length that can work with this workflow?

Improve error handling

There should be a check made to see if the API presented an error code or not. If it does it should throw an error. This will prevent error responses from being written to the json object.

No fetch-api-data-action/data.json file after action runs and log indicates "data was succesfully retrieved and saved"

Thanks for this great action! Appreciate any tips you could give for initial setup: The action appears to runs successfully and the log indicates that the json file has been created, I'm not seeing the data.json file in fetch-api-data-action. Any tips on what I'm missing? Details below.

Description of Issue

  1. Create a new workflow. Name it "Refresh Feed" and set it to run on push.
  2. While editing the workflow, look up "fetch-api-data-action" in marketplace lookup panel. Copy and paste the action as a step, and customize as described in the comments (add an Endpoint and set Retry to True).
  3. Commit new action: https://github.com/reliztrent/reliztrent.github.io/blob/master/.github/workflows/fetch-loc-gov-data.yml
  4. Make another push to repo.
  5. The action runs successfully. The log reports that the data was successfully fetched and saved.
  6. Can't find file at fetch-api-data-action/data.json

Logs

Raw log for the most recent attempt is:

2020-08-29T20:16:06.5897787Z ##[section]Starting: Request a runner to run this job
2020-08-29T20:16:07.4017088Z Can't find any online and idle self-hosted runner in current repository that matches the required labels: 'ubuntu-latest'
2020-08-29T20:16:07.4017196Z Can't find any online and idle self-hosted runner in current repository's account/organization that matches the required labels: 'ubuntu-latest'
2020-08-29T20:16:07.4017659Z Found online and idle hosted runner in current repository's account/organization that matches the required labels: 'ubuntu-latest'
2020-08-29T20:16:07.5936186Z ##[section]Finishing: Request a runner to run this job
2020-08-29T20:16:13.3953319Z Current runner version: '2.273.0'
2020-08-29T20:16:13.3976636Z ##[group]Operating System
2020-08-29T20:16:13.3977309Z Ubuntu
2020-08-29T20:16:13.3977493Z 18.04.5
2020-08-29T20:16:13.3977689Z LTS
2020-08-29T20:16:13.3977850Z ##[endgroup]
2020-08-29T20:16:13.3978017Z ##[group]Virtual Environment
2020-08-29T20:16:13.3978204Z Environment: ubuntu-18.04
2020-08-29T20:16:13.3978698Z Version: 20200817.1
2020-08-29T20:16:13.3978952Z Included Software: https://github.com/actions/virtual-environments/blob/ubuntu18/20200817.1/images/linux/Ubuntu1804-README.md
2020-08-29T20:16:13.3979352Z ##[endgroup]
2020-08-29T20:16:13.3980275Z Prepare workflow directory
2020-08-29T20:16:13.4146690Z Prepare all required actions
2020-08-29T20:16:13.4158269Z Download action repository 'JamesIves/[email protected]'
2020-08-29T20:16:26.5350979Z ##[group]Run JamesIves/[email protected]
2020-08-29T20:16:26.5351502Z with:
2020-08-29T20:16:26.5351931Z   ENDPOINT: https://www.loc.gov/maps/?fa=location:cyprus&fo=json&at=results
2020-08-29T20:16:26.5352102Z   RETRY: true
2020-08-29T20:16:26.5352201Z ##[endgroup]
2020-08-29T20:16:28.9241141Z 
2020-08-29T20:16:28.9244602Z     Fetch API Data Action 📦 🚚
2020-08-29T20:16:28.9245341Z 
2020-08-29T20:16:28.9246716Z     🚀 Getting Started Guide: https://github.com/marketplace/actions/fetch-api-data
2020-08-29T20:16:28.9247314Z     🔧 Support: https://github.com/JamesIves/fetch-api-data-action/issues
2020-08-29T20:16:28.9247892Z     ⭐ Contribute: https://github.com/JamesIves/fetch-api-data-action/blob/dev/CONTRIBUTING.md
2020-08-29T20:16:28.9249129Z     
2020-08-29T20:16:28.9249927Z     📣 Maintained by James Ives (https://jamesiv.es)
2020-08-29T20:16:28.9250944Z Checking configuration and initializing… 🚚
2020-08-29T20:16:28.9251873Z Fetching the requested data… 📦
2020-08-29T20:16:29.3847196Z Saving the data... 📁
2020-08-29T20:16:29.3905603Z The data was succesfully retrieved and saved! ✅ 🚚
2020-08-29T20:16:29.3949428Z Cleaning up orphan processes

Build script

(Just sharing a tidbit as I've stumbled on this repo through the bug discussion on setup-node action)

I see you have an npm "build" script. That should very most likely be "prepare". (Assuming that script is essentially a compilation step that should occur before publishing.)

That would also simplify your workflow because "prepare" runs automatically after npm-install.

https://docs.npmjs.com/misc/scripts#prepublish-and-prepare

No output data and invalid environment variable

Describe the bug

  1. The action output is documented in action.yml but is not being set by code.
  2. The environment variable name is not documented
  3. The environment variable name "fetch-api-data" is not valid in Linux systems because of dashes.
  4. The environment variable name is not adjustable

Reproduction Steps

Here is a small test workflow

name: CI

on:
  push:
  pull_request:
jobs:
  build:
    runs-on: [ self-hosted ]

    steps:
      - name: Fetch API Data Test
        id: fad
        uses: JamesIves/fetch-api-data-action@v2
        with:
          endpoint: https://postman-echo.com/get
      - name: Get output
        run: |
          echo "The output is not set: ${{ steps.fad.outputs.fetch-api-data }}"
      - name: Get from env
        if: always()
        run: |
          cat <<EOT
          ${{ env.fetch-api-data }}
          EOT
      - name: Access the file
        if: always()
        run: cat "fetch-api-data-action/data.json"
      - name: Access the env var in shell using an indirect reference (fails with error)
        if: always()
        shell: bash
        run: |
          name='fetch-api-data'
          echo "${!name}"
      - name: Access the env var in shell normally (fails to access data)
        if: always()
        shell: bash
        run: |
          echo "${fetch-api-data}"

Logs

Workflow execution log

....
2023-08-29T19:08:24.6809710Z Prepare workflow directory
2023-08-29T19:08:24.7382653Z Prepare all required actions
2023-08-29T19:08:24.7528405Z Getting action download info
2023-08-29T19:08:25.2141629Z Download action repository 'JamesIves/fetch-api-data-action@v2' (SHA:396ebea7d13904824f85b892b1616985f847301c)
2023-08-29T19:08:25.7624140Z Complete job name: build
2023-08-29T19:08:25.8095831Z A job started hook has been configured by the self-hosted runner administrator
2023-08-29T19:08:25.8228584Z ##[group]Run '/etc/arc/hooks/job-started.sh'
2023-08-29T19:08:25.8241998Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2023-08-29T19:08:25.8242222Z ##[endgroup]
2023-08-29T19:08:25.8837075Z �[0;37m2023-08-29 19:08:25.879  DEBUG --- Running ARC Job Started Hooks�[0m
2023-08-29T19:08:25.8837724Z �[0;37m2023-08-29 19:08:25.881  DEBUG --- Running hook: /etc/arc/hooks/job-started.d/update-status�[0m
2023-08-29T19:08:25.9176327Z ##[group]Run JamesIves/fetch-api-data-action@v2
2023-08-29T19:08:25.9176702Z with:
2023-08-29T19:08:25.9177030Z   endpoint: https://postman-echo.com/get
2023-08-29T19:08:25.9177331Z   set-output: true
2023-08-29T19:08:25.9177545Z ##[endgroup]
2023-08-29T19:08:26.1604912Z 
2023-08-29T19:08:26.1606580Z     Fetch API Data Action 📦 🚚
2023-08-29T19:08:26.1606845Z 
2023-08-29T19:08:26.1607182Z     💖 Support: https://github.com/sponsors/JamesIves
2023-08-29T19:08:26.1607547Z     📣 Maintained by James Ives: https://jamesiv.es
2023-08-29T19:08:26.1607702Z 
2023-08-29T19:08:26.1607936Z     🚀 Getting Started Guide: https://github.com/JamesIves/fetch-api-data-action
2023-08-29T19:08:26.1608573Z     ❓ Discussions / Q&A: https://github.com/JamesIves/fetch-api-data-action/discussions
2023-08-29T19:08:26.1609151Z     🔧 Report a Bug: https://github.com/JamesIves/fetch-api-data-action/issues
2023-08-29T19:08:26.1609683Z Checking configuration and initializing… 🚚
2023-08-29T19:08:26.1610379Z Fetching the requested data… 📦
2023-08-29T19:08:26.1924047Z Saving the data... 📁
2023-08-29T19:08:26.1941312Z Saved fetch-api-data-action/data.json 💾
2023-08-29T19:08:26.1948196Z The data was succesfully retrieved and saved! ✅ 🚚
2023-08-29T19:08:26.2102364Z ##[group]Run echo "The output is not set: "
2023-08-29T19:08:26.2102629Z �[36;1mecho "The output is not set: "�[0m
2023-08-29T19:08:26.2113433Z shell: /usr/bin/bash -e {0}
2023-08-29T19:08:26.2113630Z env:
2023-08-29T19:08:26.2114149Z   fetch-api-data: {
  "args": {},
  "headers": {
    "x-forwarded-proto": "https",
    "x-forwarded-port": "443",
    "host": "postman-echo.com",
    "x-amzn-trace-id": "Root=1-64ee422a-3cb9a19777a9b7942ac710fa",
    "accept": "*/*",
    "user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
    "accept-encoding": "gzip,deflate"
  },
  "url": "https://postman-echo.com/get"
}
2023-08-29T19:08:26.2114617Z ##[endgroup]
2023-08-29T19:08:26.2146234Z The output is not set: 
2023-08-29T19:08:26.2170606Z ##[group]Run cat <<EOT
2023-08-29T19:08:26.2170925Z �[36;1mcat <<EOT�[0m
2023-08-29T19:08:26.2171528Z �[36;1m{�[0m
2023-08-29T19:08:26.2171768Z �[36;1m  "args": {},�[0m
2023-08-29T19:08:26.2172055Z �[36;1m  "headers": {�[0m
2023-08-29T19:08:26.2172277Z �[36;1m    "x-forwarded-proto": "https",�[0m
2023-08-29T19:08:26.2172524Z �[36;1m    "x-forwarded-port": "443",�[0m
2023-08-29T19:08:26.2172747Z �[36;1m    "host": "postman-echo.com",�[0m
2023-08-29T19:08:26.2173029Z �[36;1m    "x-amzn-trace-id": "Root=1-64ee422a-3cb9a19777a9b7942ac710fa",�[0m
2023-08-29T19:08:26.2173254Z �[36;1m    "accept": "*/*",�[0m
2023-08-29T19:08:26.2173521Z �[36;1m    "user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",�[0m
2023-08-29T19:08:26.2173810Z �[36;1m    "accept-encoding": "gzip,deflate"�[0m
2023-08-29T19:08:26.2174021Z �[36;1m  },�[0m
2023-08-29T19:08:26.2174238Z �[36;1m  "url": "https://postman-echo.com/get"�[0m
2023-08-29T19:08:26.2174444Z �[36;1m}�[0m
2023-08-29T19:08:26.2174856Z �[36;1mEOT�[0m
2023-08-29T19:08:26.2183575Z shell: /usr/bin/bash -e {0}
2023-08-29T19:08:26.2183778Z env:
2023-08-29T19:08:26.2184282Z   fetch-api-data: {
  "args": {},
  "headers": {
    "x-forwarded-proto": "https",
    "x-forwarded-port": "443",
    "host": "postman-echo.com",
    "x-amzn-trace-id": "Root=1-64ee422a-3cb9a19777a9b7942ac710fa",
    "accept": "*/*",
    "user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
    "accept-encoding": "gzip,deflate"
  },
  "url": "https://postman-echo.com/get"
}
2023-08-29T19:08:26.2184822Z ##[endgroup]
2023-08-29T19:08:26.2229156Z {
2023-08-29T19:08:26.2229512Z   "args": {},
2023-08-29T19:08:26.2229814Z   "headers": {
2023-08-29T19:08:26.2230345Z     "x-forwarded-proto": "https",
2023-08-29T19:08:26.2230780Z     "x-forwarded-port": "443",
2023-08-29T19:08:26.2253137Z     "host": "postman-echo.com",
2023-08-29T19:08:26.2253611Z     "x-amzn-trace-id": "Root=1-64ee422a-3cb9a19777a9b7942ac710fa",
2023-08-29T19:08:26.2253840Z     "accept": "*/*",
2023-08-29T19:08:26.2254150Z     "user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
2023-08-29T19:08:26.2254435Z     "accept-encoding": "gzip,deflate"
2023-08-29T19:08:26.2254600Z   },
2023-08-29T19:08:26.2254793Z   "url": "https://postman-echo.com/get"
2023-08-29T19:08:26.2254962Z }
2023-08-29T19:08:26.2275419Z ##[group]Run cat "fetch-api-data-action/data.json"
2023-08-29T19:08:26.2275835Z �[36;1mcat "fetch-api-data-action/data.json"�[0m
2023-08-29T19:08:26.2285023Z shell: /usr/bin/bash -e {0}
2023-08-29T19:08:26.2285194Z env:
2023-08-29T19:08:26.2285663Z   fetch-api-data: {
  "args": {},
  "headers": {
    "x-forwarded-proto": "https",
    "x-forwarded-port": "443",
    "host": "postman-echo.com",
    "x-amzn-trace-id": "Root=1-64ee422a-3cb9a19777a9b7942ac710fa",
    "accept": "*/*",
    "user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
    "accept-encoding": "gzip,deflate"
  },
  "url": "https://postman-echo.com/get"
}
2023-08-29T19:08:26.2286103Z ##[endgroup]
2023-08-29T19:08:26.2328584Z {
2023-08-29T19:08:26.2328886Z   "args": {},
2023-08-29T19:08:26.2329191Z   "headers": {
2023-08-29T19:08:26.2329684Z     "x-forwarded-proto": "https",
2023-08-29T19:08:26.2330150Z     "x-forwarded-port": "443",
2023-08-29T19:08:26.2330740Z     "host": "postman-echo.com",
2023-08-29T19:08:26.2331138Z     "x-amzn-trace-id": "Root=1-64ee422a-3cb9a19777a9b7942ac710fa",
2023-08-29T19:08:26.2331395Z     "accept": "*/*",
2023-08-29T19:08:26.2331753Z     "user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
2023-08-29T19:08:26.2332084Z     "accept-encoding": "gzip,deflate"
2023-08-29T19:08:26.2332278Z   },
2023-08-29T19:08:26.2332526Z   "url": "https://postman-echo.com/get"
2023-08-29T19:08:26.2332756Z }
2023-08-29T19:08:26.2352266Z ##[group]Run name='fetch-api-data'
2023-08-29T19:08:26.2352582Z �[36;1mname='fetch-api-data'�[0m
2023-08-29T19:08:26.2352759Z �[36;1mecho "${!name}"�[0m
2023-08-29T19:08:26.2360980Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2023-08-29T19:08:26.2361183Z env:
2023-08-29T19:08:26.2361640Z   fetch-api-data: {
  "args": {},
  "headers": {
    "x-forwarded-proto": "https",
    "x-forwarded-port": "443",
    "host": "postman-echo.com",
    "x-amzn-trace-id": "Root=1-64ee422a-3cb9a19777a9b7942ac710fa",
    "accept": "*/*",
    "user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
    "accept-encoding": "gzip,deflate"
  },
  "url": "https://postman-echo.com/get"
}
2023-08-29T19:08:26.2362228Z ##[endgroup]
2023-08-29T19:08:26.2390056Z /runner/_work/_temp/d4cc5f07-7720-41c3-8e86-8ef0deab178c.sh: line 2: fetch-api-data: invalid variable name
2023-08-29T19:08:26.2399003Z ##[error]Process completed with exit code 1.
2023-08-29T19:08:26.2433640Z ##[group]Run echo "${fetch-api-data}"
2023-08-29T19:08:26.2433898Z �[36;1mecho "${fetch-api-data}"�[0m
2023-08-29T19:08:26.2442110Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2023-08-29T19:08:26.2442317Z env:
2023-08-29T19:08:26.2442790Z   fetch-api-data: {
  "args": {},
  "headers": {
    "x-forwarded-proto": "https",
    "x-forwarded-port": "443",
    "host": "postman-echo.com",
    "x-amzn-trace-id": "Root=1-64ee422a-3cb9a19777a9b7942ac710fa",
    "accept": "*/*",
    "user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
    "accept-encoding": "gzip,deflate"
  },
  "url": "https://postman-echo.com/get"
}
2023-08-29T19:08:26.2443239Z ##[endgroup]
2023-08-29T19:08:26.2473399Z api-data
2023-08-29T19:08:26.2486077Z A job completed hook has been configured by the self-hosted runner administrator
2023-08-29T19:08:26.2504798Z ##[group]Run '/etc/arc/hooks/job-completed.sh'
2023-08-29T19:08:26.2512235Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2023-08-29T19:08:26.2512527Z ##[endgroup]
2023-08-29T19:08:26.2559946Z �[0;37m2023-08-29 19:08:26.255  DEBUG --- Running ARC Job Completed Hooks�[0m
2023-08-29T19:08:26.2576253Z �[0;37m2023-08-29 19:08:26.257  DEBUG --- Running hook: /etc/arc/hooks/job-completed.d/update-status�[0m
2023-08-29T19:08:26.2752869Z Cleaning up orphan processes

Workflow

See above

Additional Comments

This action seems to be untested however it is available in the marketplace for others to use. I suggest adding a test workflow that runs on different OSes and verifies the supposed action functionality.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.